mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
8e294a5eed
- Delete llm/ dead code (3 files, zero references) - Split mcp/ into sub-packages: mcp/provider/ (8 providers) and mcp/payment/ (4 payment clients) with registry pattern - Export Client internal fields and ClientHooks interface for sub-package access - Split api/server.go (3892 lines) into 8 domain-specific handler files - Split trader/auto_trader.go (2296 lines) into 5 focused files - Reorganize web/src/components/ flat files into auth/, charts/, trader/, common/, modals/, backtest/ subdirectories - Update all consumer imports to use registry-based provider creation
84 lines
1.7 KiB
Go
84 lines
1.7 KiB
Go
package provider
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"nofx/mcp"
|
|
)
|
|
|
|
func TestOptionsWithDeepSeekClient(t *testing.T) {
|
|
logger := mcp.NewNoopLogger()
|
|
|
|
client := NewDeepSeekClientWithOptions(
|
|
mcp.WithAPIKey("sk-deepseek-key"),
|
|
mcp.WithLogger(logger),
|
|
mcp.WithMaxTokens(5000),
|
|
)
|
|
|
|
dsClient := client.(*DeepSeekClient)
|
|
|
|
// Verify DeepSeek default values
|
|
if dsClient.Provider != mcp.ProviderDeepSeek {
|
|
t.Error("Provider should be DeepSeek")
|
|
}
|
|
|
|
if dsClient.BaseURL != mcp.DefaultDeepSeekBaseURL {
|
|
t.Error("BaseURL should be DeepSeek default")
|
|
}
|
|
|
|
if dsClient.Model != mcp.DefaultDeepSeekModel {
|
|
t.Error("Model should be DeepSeek default")
|
|
}
|
|
|
|
// Verify custom options
|
|
if dsClient.APIKey != "sk-deepseek-key" {
|
|
t.Error("APIKey should be set from options")
|
|
}
|
|
|
|
if dsClient.Log != logger {
|
|
t.Error("Log should be set from options")
|
|
}
|
|
|
|
if dsClient.MaxTokens != 5000 {
|
|
t.Error("MaxTokens should be 5000")
|
|
}
|
|
}
|
|
|
|
func TestOptionsWithQwenClient(t *testing.T) {
|
|
logger := mcp.NewNoopLogger()
|
|
|
|
client := NewQwenClientWithOptions(
|
|
mcp.WithAPIKey("sk-qwen-key"),
|
|
mcp.WithLogger(logger),
|
|
mcp.WithMaxTokens(6000),
|
|
)
|
|
|
|
qwenClient := client.(*QwenClient)
|
|
|
|
// Verify Qwen default values
|
|
if qwenClient.Provider != mcp.ProviderQwen {
|
|
t.Error("Provider should be Qwen")
|
|
}
|
|
|
|
if qwenClient.BaseURL != mcp.DefaultQwenBaseURL {
|
|
t.Error("BaseURL should be Qwen default")
|
|
}
|
|
|
|
if qwenClient.Model != mcp.DefaultQwenModel {
|
|
t.Error("Model should be Qwen default")
|
|
}
|
|
|
|
// Verify custom options
|
|
if qwenClient.APIKey != "sk-qwen-key" {
|
|
t.Error("APIKey should be set from options")
|
|
}
|
|
|
|
if qwenClient.Log != logger {
|
|
t.Error("Log should be set from options")
|
|
}
|
|
|
|
if qwenClient.MaxTokens != 6000 {
|
|
t.Error("MaxTokens should be 6000")
|
|
}
|
|
}
|