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
29 lines
1.1 KiB
Go
29 lines
1.1 KiB
Go
package mcp
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// ClientEmbedder is implemented by provider types that embed *Client,
|
|
// allowing generic extraction of the underlying base client (e.g. for cloning).
|
|
type ClientEmbedder interface {
|
|
BaseClient() *Client
|
|
}
|
|
|
|
// AIClient public AI client interface (for external use)
|
|
type AIClient interface {
|
|
SetAPIKey(apiKey string, customURL string, customModel string)
|
|
SetTimeout(timeout time.Duration)
|
|
CallWithMessages(systemPrompt, userPrompt string) (string, error)
|
|
CallWithRequest(req *Request) (string, error)
|
|
// CallWithRequestStream streams the LLM response via SSE.
|
|
// onChunk is called with the full accumulated text so far (not raw deltas).
|
|
// Returns the complete final text when done.
|
|
CallWithRequestStream(req *Request, onChunk func(string)) (string, error)
|
|
// CallWithRequestFull returns both text content and tool calls.
|
|
// Use this when the request includes Tools — the LLM may respond with
|
|
// either a plain text reply (LLMResponse.Content) or tool invocations
|
|
// (LLMResponse.ToolCalls), but not both.
|
|
CallWithRequestFull(req *Request) (*LLMResponse, error)
|
|
}
|