Skip to content

run-applio.bat opens a command prompt but nothing happens #32

run-applio.bat opens a command prompt but nothing happens

run-applio.bat opens a command prompt but nothing happens #32

Workflow file for this run

name: Issue Management
on:
issues:
types: [opened, edited, reopened]
issue_comment:
types: [created]
jobs:
check_issue_template:
runs-on: ubuntu-latest
if: github.event_name == 'issues' || (github.event_name == 'issue_comment' && github.event.issue.pull_request == null)
outputs:
template_followed: ${{ steps.check_template.outputs.template_followed }}
steps:
- name: Check Issue Template
id: check_template
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue = context.payload.issue;
const requiredSections = [
'**Bug Description**',
'**Steps to Reproduce**',
'**Desktop Details:**',
];
const body = issue.body || '';
const missingFields = requiredSections.filter(section => {
const sectionContent = body.split(section)[1];
return !sectionContent || sectionContent.trim().length < 5;
});
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
});
const warningMessageExists = comments.data.some(comment =>
comment.body.includes('Thank you for your issue report. However, it appears that your issue description is')
);
if (missingFields.length > 0 && !warningMessageExists) {
let message = `Thank you for your issue report. However, it appears that your issue description is ${context.payload.action === 'reopened' ? 'still ' : ''}missing or has incomplete information for the following required sections:\n${missingFields.map(field => `- ${field}`).join('\n')}\n\nPlease edit your issue to include all required information using our issue template. This helps us address your concern more effectively.\nIf you need assistance with the template or have any questions, please join our Discord server for support.`;
if (context.payload.action !== 'reopened' && context.payload.action !== 'edited') {
message += '\n\nThis issue will be closed automatically if not updated with complete information within 24 hours. Feel free to reopen it once you\'ve updated it with the required information.';
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: message
});
core.setOutput('template_followed', 'false');
} else {
core.setOutput('template_followed', 'true');
}
auto_reply:
runs-on: ubuntu-latest
needs: check_issue_template
if: needs.check_issue_template.outputs.template_followed == 'true' && github.event.issue.pull_request == null
steps:
- name: Generate Response and Post Comment
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue = context.payload.issue;
const comment = context.payload.comment;
const repo = context.repo.repo;
const issueNumber = issue.number;
const issueBody = issue.body;
const groqApiKey = process.env.GROQ_API_KEY;
const issueAuthor = issue.user.login;
const commentAuthor = comment ? comment.user.login : null;
const systemPrompt = `You are an assistant for a GitHub repository called Applio (https://github.com/IAHispano/Applio), a Python project focused on voice cloning. Your job is to assist users with any issues or bugs they report, providing clear, helpful and short guidance. You can troubleshoot various technical problems and offer solutions, code snippets, or documentation references as needed. Be concise, efficient, and to the point when responding to the following GitHub issue. Try to answer in a paragraph whenever possible and if you are not sure of the answer ask the user for more details. If relevant, refer users to the official documentation at https://docs.applio.org, just share that link, do not add any extension to it. Issue content: ${issueBody}`;
async function getAIResponse(prompt) {
const response = await fetch('https://api.groq.com/openai/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${groqApiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
messages: [
{ role: 'system', content: prompt },
{ role: 'user', content: issueBody },
],
model: 'llama-3.1-70b-versatile',
temperature: 0.6,
}),
});
if (!response.ok) {
throw new Error('Failed to fetch response from LLM');
}
const data = await response.json();
return data.choices[0].message.content;
}
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: repo,
issue_number: issueNumber,
});
const discordRecommendation = 'consider joining our support community on [Discord](https://discord.gg/iahispano)';
const hasDiscordRecommendation = comments.data.some(comment => comment.body.includes(discordRecommendation));
if (hasDiscordRecommendation) {
console.log("Discord recommendation already posted. No further responses.");
return;
}
if (comment) {
if (commentAuthor === issueAuthor) {
const followUpPrompt = `The user has sent another comment. Try to get him to provide more information about his error and try to help him as much as possible precisely and concisely, whenever possible in a paragraph.`;
const aiResponse = await getAIResponse(followUpPrompt);
const commentMessage = `${aiResponse}\n\nIf you're looking for faster assistance, consider joining our support community on [Discord](https://discord.gg/iahispano), or please wait for a staff member to assist.`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: repo,
issue_number: issueNumber,
body: commentMessage,
});
}
} else {
const initialResponse = await getAIResponse(systemPrompt);
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: repo,
issue_number: issueNumber,
body: initialResponse,
});
const followUpMessage = `
If this issue persists or you need further assistance, please visit our support community at [discord.gg/iahispano](https://discord.gg/iahispano).
Our community is available to help with any additional questions or concerns.
`;
const hasFollowUpComment = comments.data.some(comment =>
comment.body.includes('If this issue persists or you need further assistance')
);
if (!hasFollowUpComment) {
setTimeout(async () => {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: repo,
issue_number: issueNumber,
body: followUpMessage,
});
}, 72 * 60 * 60 * 1000);
}
}
env:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}