refactor: 简化请求转换函数和流处理逻辑

This commit is contained in:
somnifex
2025-09-15 23:41:09 +08:00
parent 176fd6eda1
commit f7d393fc72
4 changed files with 49 additions and 51 deletions

View File

@@ -4,7 +4,6 @@ import (
"encoding/json"
)
// OllamaChatMessage represents a single chat message
type OllamaChatMessage struct {
Role string `json:"role"`
Content string `json:"content,omitempty"`
@@ -32,7 +31,6 @@ type OllamaToolCall struct {
} `json:"function"`
}
// OllamaChatRequest -> /api/chat
type OllamaChatRequest struct {
Model string `json:"model"`
Messages []OllamaChatMessage `json:"messages"`
@@ -44,7 +42,6 @@ type OllamaChatRequest struct {
Think json.RawMessage `json:"think,omitempty"`
}
// OllamaGenerateRequest -> /api/generate
type OllamaGenerateRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt,omitempty"`