Skip to content

Commit

Permalink
Merge branch 'develop' into feature/insert_image_to_prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
pacificbelt30 committed Aug 9, 2024
2 parents 956fb76 + d84e3ba commit 4d39729
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/alert-menta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: |
curl -sLJO -H 'Accept: application/octet-stream' \
"https://${{ secrets.GH_TOKEN }}@api.github.com/repos/3-shake/alert-menta/releases/assets/$( \
curl -sL "https://${{ secrets.GH_TOKEN }}@api.github.com/repos/3-shake/alert-menta/releases/tags/v0.0.3" \
curl -sL "https://${{ secrets.GH_TOKEN }}@api.github.com/repos/3-shake/alert-menta/releases/tags/v0.0.4" \
| jq '.assets[] | select(.name | contains("Linux_x86")) | .id')"
tar -zxvf alert-menta_Linux_x86_64.tar.gz
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Add Comment
run: |
if [[ "$COMMAND" == "ask" ]]; then
./alert-menta -owner ${{ github.repository_owner }} -issue ${{ github.event.issue.number }} -repo ${{ env.REPOSITORY_NAME }} -github-token ${{ secrets.GH_TOKEN }} -api-key ${{ secrets.OPENAI_API_KEY }} -command $COMMAND -config $CONFIG_FILE -intent $INTENT
./alert-menta -owner ${{ github.repository_owner }} -issue ${{ github.event.issue.number }} -repo ${{ env.REPOSITORY_NAME }} -github-token ${{ secrets.GH_TOKEN }} -api-key ${{ secrets.OPENAI_API_KEY }} -command $COMMAND -config $CONFIG_FILE -intent "$INTENT"
else
./alert-menta -owner ${{ github.repository_owner }} -issue ${{ github.event.issue.number }} -repo ${{ env.REPOSITORY_NAME }} -github-token ${{ secrets.GH_TOKEN }} -api-key ${{ secrets.OPENAI_API_KEY }} -command $COMMAND -config $CONFIG_FILE
fi
13 changes: 9 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func main() {
)
flag.Parse()

if *repo == "" || *owner == "" || *issueNumber == 0 || *gh_token == "" || *oai_key == "" || *command == "" || *configFile == "" {
if *repo == "" || *owner == "" || *issueNumber == 0 || *gh_token == "" || *command == "" || *configFile == "" {
flag.PrintDefaults()
os.Exit(1)
}
Expand Down Expand Up @@ -112,16 +112,21 @@ func main() {
flag.PrintDefaults()
os.Exit(1)
}
system_prompt = cfg.Ai.Commands[*command].System_prompt + *intent
system_prompt = cfg.Ai.Commands[*command].System_prompt + *intent + "\n"
} else {
system_prompt = cfg.Ai.Commands[*command].System_prompt
}
prompt := ai.Prompt{UserPrompt: user_prompt, SystemPrompt: system_prompt, Images: images}
logger.Println("\x1b[34mPrompt: |\n", prompt.SystemPrompt, prompt.UserPrompt, "\x1b[0m + ", len(prompt.Images), "images")
prompt := ai.Prompt{UserPrompt: user_prompt, SystemPrompt: system_prompt}
logger.Println("\x1b[34mPrompt: |\n", prompt.SystemPrompt, prompt.UserPrompt, "\x1b[0m")

// Get response from OpenAI or VertexAI
var aic ai.Ai
if cfg.Ai.Provider == "openai" {
if *oai_key == "" {
logger.Println("Error: Please provide your Open AI API key.")
flag.PrintDefaults()
os.Exit(1)
}
aic = ai.NewOpenAIClient(*oai_key, cfg.Ai.OpenAI.Model)
logger.Println("Using OpenAI API")
logger.Println("OpenAI model:", cfg.Ai.OpenAI.Model)
Expand Down

0 comments on commit 4d39729

Please sign in to comment.