mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-17 09:24:36 +08:00
Improve(interface): replace some struct with interface for testing (#994)
* 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>
This commit is contained in:
53
mcp/deepseek_client.go
Normal file
53
mcp/deepseek_client.go
Normal file
@@ -0,0 +1,53 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user