Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
add role
Browse files Browse the repository at this point in the history
  • Loading branch information
cubatic45 committed Mar 15, 2024
1 parent 07caf1f commit 0ef7ed2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type streamOutput struct {
Choices []struct {
Index int `json:"index"`
Delta struct {
Role string `json:"role"`
Content string `json:"content"`
} `json:"delta"`
} `json:"choices"`
Expand Down Expand Up @@ -94,7 +95,8 @@ func (p *Proxy) scanStream(w http.ResponseWriter, r *http.Response) {
if len(output.Choices) == 0 {
continue
}
for _, c := range output.Choices {
for i, c := range output.Choices {
output.Choices[i].Delta.Role = "assistant"
if c.Delta.Content == "" {
continue
}
Expand Down

0 comments on commit 0ef7ed2

Please sign in to comment.