LLM config
All checks were successful
Gitea Actions Demo / deploy (push) Successful in 29s

This commit is contained in:
2026-02-27 09:50:11 +08:00
parent 839cdbdbc7
commit 756f871b4e
3 changed files with 8 additions and 4 deletions

4
.env
View File

@ -15,4 +15,6 @@ DB_PASS=postgres
DB_NAME=peter
# LLM配置
LLM_API_KEY=sk-88d6437a6c224ccbb761ec7d994e3b34
LLM_API_KEY=sk-c334321367e843e58faf39956fbb7304
LLM_MODEL=deepseek-v3.2
LLM_MAX_TOKENS=4096

View File

@ -24,6 +24,8 @@ class Settings(BaseSettings):
# LLM配置
LLM_API_KEY: str = Field("LLM_API_KEY")
LLM_MODEL: str = Field("LLM_MODEL", default="deepseek-v3.2")
LLM_MAX_TOKENS: int = Field("LLM_MAX_TOKENS", default=2048)
class Config:
env_file = ".env"

View File

@ -1,7 +1,7 @@
from typing import Optional, Dict
from dataclasses import dataclass
import os
from config.settings import settings
from config import settings
from openai import OpenAI
from utils import logger
@ -11,10 +11,10 @@ class LLMConfig:
"""LLM配置类"""
api_key: Optional[str] = None
base_url: str = "https://dashscope.aliyuncs.com/compatible-mode/v1"
model: str = "qwen3.5-plus"
model: str = settings.LLM_MODEL
enable_thinking: bool = True
temperature: float = 0.7
max_tokens: int = 4096
max_tokens: int = settings.LLM_MAX_TOKENS
class LLMThinkingEngine: