update
This commit is contained in:
@@ -37,7 +37,10 @@ type ChatRequest struct {
|
||||
TopP float64 `json:"top_p,omitempty"` // 采样参数
|
||||
FrequencyPenalty float64 `json:"frequency_penalty,omitempty"` // 频率惩罚
|
||||
PresencePenalty float64 `json:"presence_penalty,omitempty"` // 存在惩罚
|
||||
Stream bool `json:"stream,omitempty"` // 是否流式输出
|
||||
Stream bool `json:"stream"` // 是否流式输出
|
||||
Thinking struct {
|
||||
Type string `json:"type"`
|
||||
} `json:"thinking"`
|
||||
}
|
||||
|
||||
// OllamaMessage Ollama消息格式
|
||||
@@ -113,10 +116,10 @@ func NewLLMClient(config LLMConfig) *LLMClient {
|
||||
}
|
||||
|
||||
// NewOpenAIClient 创建OpenAI客户端
|
||||
func NewOpenAIClient(apiKey, model string) *LLMClient {
|
||||
func NewOpenAIClient(apiKey, model, baseURL string) *LLMClient {
|
||||
config := LLMConfig{
|
||||
APIKey: apiKey,
|
||||
BaseURL: "https://api.openai.com/v1",
|
||||
BaseURL: baseURL,
|
||||
Model: model,
|
||||
Provider: "openai",
|
||||
Temperature: 0.1,
|
||||
@@ -149,6 +152,12 @@ func (c *LLMClient) Chat(messages []ChatMessage) (*ChatResponse, error) {
|
||||
Messages: messages,
|
||||
Temperature: c.config.Temperature,
|
||||
MaxTokens: c.config.MaxTokens,
|
||||
Stream: false,
|
||||
Thinking: struct {
|
||||
Type string `json:"type"`
|
||||
}{
|
||||
Type: "disabled",
|
||||
},
|
||||
}
|
||||
|
||||
return c.sendChatRequest(request)
|
||||
|
||||
Reference in New Issue
Block a user