Author SHA1 Message Date
cat-shark 7c751bfc02 feat: LLM 切换为 DeepSeek deepseek-flash 2026-10-08 12:29:41 +08:00
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -11,7 +11,7 @@
- 运行时:Node.js 20+ - 运行时:Node.js 20+
- 框架:Fastify 5 - 框架:Fastify 5
- LLM:SiliconFlow OpenAI 兼容接口(Qwen/Qwen2.5-32B-Instruct) - LLM:DeepSeek OpenAI 兼容接口(deepseek-flash / DeepSeek-V4.1-Flash)
- 运行时依赖:除 fastify 外无其他外部依赖 - 运行时依赖:除 fastify 外无其他外部依赖
## 项目结构 ## 项目结构
@@ -60,9 +60,9 @@ lpt-ai/src/
## LLM 配置 ## LLM 配置
```env ```env
LLM_API_URL=https://api.siliconflow.cn/v1/chat/completions LLM_API_URL=https://api.deepseek.com/v1/chat/completions
LLM_API_KEY= # 必填,未配置时 /health 返回 llmAvailable: false LLM_API_KEY= # 必填,未配置时 /health 返回 llmAvailable: false
LLM_MODEL=Qwen/Qwen2.5-32B-Instruct LLM_MODEL=deepseek-flash
LLM_TIMEOUT_MS=60000 # 单次 LLM 调用超时 LLM_TIMEOUT_MS=60000 # 单次 LLM 调用超时
PORT=5199 PORT=5199
``` ```
+3 -3
View File
@@ -1,5 +1,5 @@
/** /**
* LLM 客户端 — SiliconFlow OpenAI 兼容接口 * LLM 客户端 — DeepSeek OpenAI 兼容接口
* *
* 设计要点: * 设计要点:
* - Key 从环境变量读取,永不写入代码或日志 * - Key 从环境变量读取,永不写入代码或日志
@@ -21,9 +21,9 @@ export interface LlmConfig {
export function loadConfig(): LlmConfig { export function loadConfig(): LlmConfig {
return { return {
apiUrl: process.env.LLM_API_URL ?? "https://api.siliconflow.cn/v1/chat/completions", apiUrl: process.env.LLM_API_URL ?? "https://api.deepseek.com/v1/chat/completions",
apiKey: process.env.LLM_API_KEY ?? "", apiKey: process.env.LLM_API_KEY ?? "",
model: process.env.LLM_MODEL ?? "Qwen/Qwen2.5-32B-Instruct", model: process.env.LLM_MODEL ?? "deepseek-flash",
timeoutMs: Number(process.env.LLM_TIMEOUT_MS ?? 120000), timeoutMs: Number(process.env.LLM_TIMEOUT_MS ?? 120000),
}; };
} }