feat: djapi 数据源归一化 + bug 修复 + 废弃 getDivData_AK
- 新增 djapi/api/stock/data_source.py 统一数源入口 (Tushare 单例) - 迁移 10 个模块至统一数据源入口 - 废弃 getDivData_AK.py - 修复 getStockDiv2.py / smoothBrush.py 等模块 - indexDatas API 参数 tscode 类型修正 (股票→指数代码) - views.py + urls.py 接口清理 - continuation.md 状态更新 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -127,13 +127,14 @@ class DeepSeekAPI:
|
||||
else:
|
||||
raise Exception("API请求失败,未知错误")
|
||||
|
||||
def process_text(self,
|
||||
prompt: str,
|
||||
text: str,
|
||||
def process_text(self,
|
||||
prompt: str,
|
||||
text: str,
|
||||
system_prompt: Optional[str] = None,
|
||||
model: str = "deepseek-chat",
|
||||
temperature: float = 0.7,
|
||||
max_tokens: int = 2000) -> str:
|
||||
max_tokens: int = 2000,
|
||||
response_format: Optional[Dict] = None) -> str:
|
||||
"""
|
||||
处理文本的通用方法
|
||||
|
||||
@@ -179,6 +180,8 @@ class DeepSeekAPI:
|
||||
"max_tokens": max_tokens,
|
||||
"stream": False
|
||||
}
|
||||
if response_format:
|
||||
payload["response_format"] = response_format
|
||||
|
||||
try:
|
||||
# 发送API请求
|
||||
@@ -236,14 +239,15 @@ def deepseek_text(text, prompt):
|
||||
custom_system_prompt = "你是一个专业的文本分析助手,擅长根据提示词对长文本进行深入分析。"
|
||||
|
||||
try:
|
||||
# 处理文本
|
||||
# 处理文本(使用 response_format 强制返回 JSON)
|
||||
result = api_client.process_text(
|
||||
model="deepseek-reasoner",
|
||||
model=os.getenv('DEEPSEEK_MODEL', 'deepseek-chat'),
|
||||
prompt=prompt,
|
||||
text=text,
|
||||
system_prompt=custom_system_prompt,
|
||||
temperature=0.5,
|
||||
max_tokens=20000
|
||||
max_tokens=20000,
|
||||
response_format={"type": "json_object"}
|
||||
)
|
||||
|
||||
#print("处理结果:")
|
||||
|
||||
Reference in New Issue
Block a user