Skip to content

Commit 4e86239

Browse files
committed
proxy: restrict loading message to /v1/chat/completions
1 parent 5befa0a commit 4e86239

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

proxy/process.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,10 @@ func (p *Process) ProxyRequest(w http.ResponseWriter, r *http.Request) {
507507
// add a sync so the streaming client only runs when the goroutine has exited
508508

509509
isStreaming, _ := r.Context().Value(proxyCtxKey("streaming")).(bool)
510-
if p.config.SendLoadingState != nil && *p.config.SendLoadingState && isStreaming {
510+
511+
// PR #417 (no support for anthropic v1/messages yet)
512+
isChatCompletions := strings.HasPrefix(r.URL.Path, "/v1/chat/completions")
513+
if p.config.SendLoadingState != nil && *p.config.SendLoadingState && isStreaming && isChatCompletions {
511514
srw = newStatusResponseWriter(p, w)
512515
go srw.statusUpdates(swapCtx)
513516
} else {

0 commit comments

Comments
 (0)