feat(AI): streaming response
This commit is contained in:
parent
7b2d3c31e5
commit
bd5e8112a1
3 changed files with 168 additions and 14 deletions
|
|
@ -44,3 +44,28 @@ type ChatResponse struct {
|
|||
Usage map[string]int `json:"usage"`
|
||||
Choices []ChatResponseChoice `json:"choices"`
|
||||
}
|
||||
|
||||
type ChatResponseStream struct {
|
||||
ID string
|
||||
Object string
|
||||
Created int
|
||||
Model string
|
||||
Stream chan string
|
||||
Err error
|
||||
}
|
||||
|
||||
type ChatResponseStreamChunk struct {
|
||||
ID string
|
||||
Object string
|
||||
Created int
|
||||
Model string
|
||||
Choices []ChatResponseStreamChoice
|
||||
}
|
||||
|
||||
type ChatResponseStreamChoice struct {
|
||||
Index int `json:"index"`
|
||||
FinishReason string `json:"finish_reason"`
|
||||
Delta struct {
|
||||
Content string `json:"content"`
|
||||
} `json:"delta"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue