feat: initialize terminal chat example with streaming and memory

This commit is contained in:
loveuer committed 2026-11-13 18:55:08 +08:00
commit 43fc905c82
13 files changed
+666

No files matched your search

+26
View File
@@ -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"`
}