feat: initialize terminal chat example with streaming and memory
This commit is contained in:
commit
43fc905c82
13 files changed
+666
No files matched your search
@@ -0,0 +1,26 @@
|
||||
package model
|
||||
|
||||
// ChatCompletionRequest 表示对话接口的请求参数。
|
||||
type ChatCompletionRequest struct {
|
||||
Model string `json:"model"`
|
||||
Messages []ChatMessage `json:"messages"`
|
||||
Stream bool `json:"stream,omitempty"`
|
||||
}
|
||||
|
||||
// ChatCompletionResponse 表示对话接口的响应。
|
||||
type ChatCompletionResponse struct {
|
||||
Choices []ChatCompletionChoice `json:"choices"`
|
||||
}
|
||||
|
||||
// ChatCompletionChoice 表示模型返回的一个候选回答。
|
||||
type ChatCompletionChoice struct {
|
||||
Message ChatMessage `json:"message"`
|
||||
Delta ChatCompletionDelta `json:"delta"`
|
||||
FinishReason string `json:"finish_reason"`
|
||||
}
|
||||
|
||||
// ChatCompletionDelta 表示流式响应中的增量内容。
|
||||
type ChatCompletionDelta struct {
|
||||
Content string `json:"content"`
|
||||
ToolCalls []ToolCall `json:"tool_calls"`
|
||||
}
|
||||
Reference in new issue
Block a user