Documentation
¶
Index ¶
Constants ¶
View Source
const (
BaseURL = "https://chat.deepseek.com/api/v0"
)
Variables ¶
View Source
var EnableDebug = false
EnableDebug 启用调试模式,打印详细的请求和响应信息
Functions ¶
func FindWASMPath ¶
FindWASMPath 查找 WASM 文件路径(用于自定义 WASM 文件) 默认情况下,WASM 文件已经嵌入到二进制中,不需要从文件系统查找 此函数仅用于需要从文件系统加载自定义 WASM 文件的场景
func GetDefaultWASMPath ¶
func GetDefaultWASMPath() string
GetDefaultWASMPath 获取默认的 WASM 文件路径(已废弃,使用 FindWASMPath) Deprecated: Use FindWASMPath instead
Types ¶
type ChallengeConfig ¶
type ChallengeConfig struct {
Algorithm string `json:"algorithm"`
Challenge string `json:"challenge"`
Salt string `json:"salt"`
Difficulty int `json:"difficulty"`
ExpireAt int `json:"expire_at"`
Signature string `json:"signature"`
TargetPath string `json:"target_path"`
}
ChallengeConfig 表示 PoW 挑战的配置
type Chunk ¶
type Chunk struct {
Type string `json:"type"` // "text" 或 "thinking"
Content string `json:"content"` // 内容
MessageID string `json:"message_id"` // 消息 ID(如果有)
FinishReason string `json:"finish_reason"` // 完成原因(如果有)
}
Chunk 表示流式响应的一个数据块
type DeepSeekAPI ¶
type DeepSeekAPI struct {
// contains filtered or unexported fields
}
DeepSeekAPI DeepSeek API 客户端
func NewDeepSeekAPI ¶
func NewDeepSeekAPI(authToken string) (*DeepSeekAPI, error)
NewDeepSeekAPI 创建新的 API 客户端 WASM 文件已嵌入到二进制中,无需指定路径
func NewDeepSeekAPIWithCustomWASM ¶
func NewDeepSeekAPIWithCustomWASM(authToken string, wasmPath string) (*DeepSeekAPI, error)
NewDeepSeekAPIWithCustomWASM 使用自定义 WASM 文件创建 API 客户端 仅在需要测试或使用自定义 WASM 文件时使用
func (*DeepSeekAPI) ChatCompletion ¶
func (api *DeepSeekAPI) ChatCompletion(chatSessionID, prompt string, parentMessageID *string, thinkingEnabled, searchEnabled bool) (<-chan Chunk, <-chan error)
ChatCompletion 发送消息并获取流式响应
func (*DeepSeekAPI) CreateChatSession ¶
func (api *DeepSeekAPI) CreateChatSession() (string, error)
CreateChatSession 创建新的聊天会话
type DeepSeekHash ¶
type DeepSeekHash struct {
// contains filtered or unexported fields
}
DeepSeekHash 处理哈希计算
type DeepSeekPOW ¶
type DeepSeekPOW struct {
// contains filtered or unexported fields
}
DeepSeekPOW 处理 DeepSeek 的 Proof of Work 挑战
func NewDeepSeekPOW ¶
func NewDeepSeekPOW(wasmPath string) (*DeepSeekPOW, error)
NewDeepSeekPOW 创建一个新的 PoW 求解器 如果 wasmPath 为空,使用嵌入的 WASM 文件;否则从文件系统读取
func (*DeepSeekPOW) SolveChallenge ¶
func (p *DeepSeekPOW) SolveChallenge(config ChallengeConfig) (string, error)
SolveChallenge 解决 PoW 挑战并返回编码后的响应
Click to show internal directories.
Click to hide internal directories.
