20260123
This commit is contained in:
parent
afdb60e8ef
commit
98b75a732c
|
|
@ -6,14 +6,27 @@ from pydantic import BaseModel, Field
|
||||||
import yaml
|
import yaml
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
SYSTEM_PROMPT = """
|
||||||
|
你是一个专业开发者,请根据以下 git diff 生成一条符合 Conventional Commits 规范的中文 commit message。
|
||||||
|
要求:50字以内,不要解释,不要引号,只输出 message 本身。\n
|
||||||
|
diff:\n"
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class LLMConfig(BaseModel):
|
class LLMConfig(BaseModel):
|
||||||
"""LLM配置模型"""
|
"""LLM配置模型"""
|
||||||
api_key: Optional[str] = Field(None, description="LLM API密钥")
|
api_key: Optional[str] = Field(None, description="LLM API密钥")
|
||||||
base_url: str = Field("https://api.openai.com/v1", description="API基础URL")
|
base_url: str = Field("https://dashscope.aliyuncs.com/compatible-mode/v1", description="API基础URL")
|
||||||
model: str = Field("gpt-3.5-turbo", description="模型名称")
|
model: str = Field("qwen3-14b", description="模型名称")
|
||||||
timeout: int = Field(30, description="请求超时时间(秒)")
|
timeout: int = Field(30, description="请求超时时间(秒)")
|
||||||
max_tokens: int = Field(1000, description="最大生成token数")
|
max_tokens: int = Field(1000, description="最大生成token数")
|
||||||
temperature: float = Field(0.7, description="温度参数")
|
temperature: float = Field(0.7, description="温度参数")
|
||||||
|
extra_body: Dict = field(default_factory=lambda: {"enable_thinking": False})
|
||||||
|
response_format: bool = field(default_factory=lambda: {"type": "json_object"})
|
||||||
|
system_prompt: str = SYSTEM_PROMPT
|
||||||
|
# stream_output: bool = False
|
||||||
|
|
||||||
|
|
||||||
class AppConfig(BaseModel):
|
class AppConfig(BaseModel):
|
||||||
"""应用配置"""
|
"""应用配置"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue