Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzz1y committed Aug 28, 2023
1 parent 4ddb4dd commit 1b8d63d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/matrix-gpt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ func main() {
Name: "gpt-timeout",
Usage: "Time to wait for a GPT response (in seconds)",
EnvVars: []string{"GPT_TIMEOUT"},
Value: 35,
Value: 60,
},
&cli.IntFlag{
Name: "max-attempts",
Usage: "Maximum number of attempts for GPT requests",
EnvVars: []string{"MAX_ATTEMPTS"},
Value: 1,
Value: 3,
},
&cli.StringSliceFlag{
Name: "user-ids",
Expand Down
2 changes: 2 additions & 0 deletions internal/bot/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ func (b *Bot) err(evt *event.Event, err error) {
default:
if errors.Is(err, context.DeadlineExceeded) {
b.markdownResponse(evt, true, timeoutMsg)
} else {
b.reactionResponse(evt, "❌")
}
}
}
3 changes: 2 additions & 1 deletion internal/bot/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const (
**Notes**
- You can use the first letter of a command as an alias. For example, "!i" for "!image".
- If you wish to terminate the current processing, simply delete your message from the chat.
- The bot responds with ❌ reaction if there are any errors. Contact the administrator if you see this.
`
timeoutMsg = "Timeout error. Please try again. If issue persists, contact the administrator."
unknownCommandMsg = "Unknown command. Please use the `!help` command to access the available commands"
unknownCommandMsg = "Unknown command. Please use the `!help` command to access the available commands."
)
2 changes: 1 addition & 1 deletion internal/gpt/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (g *Gpt) createCompletionWithTimeout(ctx context.Context, msg []openai.Chat
continue
}

time.Sleep(time.Duration(i*2) * time.Second)
time.Sleep(time.Duration(i*3) * time.Second)
}

return openai.ChatCompletionResponse{}, err
Expand Down

0 comments on commit 1b8d63d

Please sign in to comment.