mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-06 20:41:14 +08:00
* fix(trader): get peakPnlPct using posKey * fix(docs): keep readme at the same page * improve(interface): replace with interface * refactor mcp --------- Co-authored-by: zbhan <zbhan@freewheel.tv>
54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package mcp
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
const (
|
|
ProviderDeepSeek = "deepseek"
|
|
DefaultDeepSeekBaseURL = "https://api.deepseek.com/v1"
|
|
DefaultDeepSeekModel = "deepseek-chat"
|
|
)
|
|
|
|
type DeepSeekClient struct {
|
|
*Client
|
|
}
|
|
|
|
func NewDeepSeekClient() AIClient {
|
|
client := New().(*Client)
|
|
client.Provider = ProviderDeepSeek
|
|
client.Model = DefaultDeepSeekModel
|
|
client.BaseURL = DefaultDeepSeekBaseURL
|
|
return &DeepSeekClient{
|
|
Client: client,
|
|
}
|
|
}
|
|
|
|
func (dsClient *DeepSeekClient) SetAPIKey(apiKey string, customURL string, customModel string) {
|
|
if dsClient.Client == nil {
|
|
dsClient.Client = New().(*Client)
|
|
}
|
|
dsClient.Client.APIKey = apiKey
|
|
|
|
if len(apiKey) > 8 {
|
|
log.Printf("🔧 [MCP] DeepSeek API Key: %s...%s", apiKey[:4], apiKey[len(apiKey)-4:])
|
|
}
|
|
if customURL != "" {
|
|
dsClient.Client.BaseURL = customURL
|
|
log.Printf("🔧 [MCP] DeepSeek 使用自定义 BaseURL: %s", customURL)
|
|
} else {
|
|
log.Printf("🔧 [MCP] DeepSeek 使用默认 BaseURL: %s", dsClient.Client.BaseURL)
|
|
}
|
|
if customModel != "" {
|
|
dsClient.Client.Model = customModel
|
|
log.Printf("🔧 [MCP] DeepSeek 使用自定义 Model: %s", customModel)
|
|
} else {
|
|
log.Printf("🔧 [MCP] DeepSeek 使用默认 Model: %s", dsClient.Client.Model)
|
|
}
|
|
}
|
|
|
|
func (dsClient *DeepSeekClient) setAuthHeader(reqHeaders http.Header) {
|
|
dsClient.Client.setAuthHeader(reqHeaders)
|
|
}
|