Skip to content

Commit

Permalink
Increase timeout durations from 2/3 minutes to 5 minutes for chat and…
Browse files Browse the repository at this point in the history
… completion streams. (#592)
  • Loading branch information
swuecho authored Feb 5, 2025
1 parent eb3b4f6 commit a3d7df9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/chat_main_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func (h *ChatHandler) chatStream(w http.ResponseWriter, chatSession sqlc_queries
return nil, err
}
log.Printf("%+v", openai_req)
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()

if !streamOutput {
Expand Down Expand Up @@ -676,7 +676,7 @@ func (h *ChatHandler) CompletionStream(w http.ResponseWriter, chatSession sqlc_q
Prompt: prompt,
Stream: true,
}
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
stream, err := client.CreateCompletionStream(ctx, req)
if err != nil {
Expand Down Expand Up @@ -818,7 +818,7 @@ func (h *ChatHandler) chatStreamClaude(w http.ResponseWriter, chatSession sqlc_q

// create the http client and send the request
client := &http.Client{
Timeout: 2 * time.Minute,
Timeout: 5 * time.Minute,
}
resp, err := client.Do(req)
if err != nil {
Expand Down Expand Up @@ -986,7 +986,7 @@ func (h *ChatHandler) chatStreamClaude3(w http.ResponseWriter, chatSession sqlc_

// create the http client and send the request
client := &http.Client{
Timeout: 2 * time.Minute,
Timeout: 5 * time.Minute,
}
resp, err := client.Do(req)
if err != nil {
Expand Down Expand Up @@ -1144,7 +1144,7 @@ func (h *ChatHandler) chatOllamStream(w http.ResponseWriter, chatSession sqlc_qu

// create the http client and send the request
client := &http.Client{
Timeout: 2 * time.Minute,
Timeout: 5 * time.Minute,
}
resp, err := client.Do(req)
if err != nil {
Expand Down

0 comments on commit a3d7df9

Please sign in to comment.