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:
@@ -166,7 +166,7 @@ def transcribe_audio(audio_path):
|
||||
dashscope.api_key = os.getenv('DASHSCOPE_API_KEY', '')
|
||||
# 创建识别对象
|
||||
recognition = Recognition(
|
||||
model='paraformer-realtime-v2', # 使用实时识别模型
|
||||
model=os.getenv('DASHSCOPE_ASR_MODEL', 'paraformer-realtime-v2'),
|
||||
format='wav',
|
||||
sample_rate=16000,
|
||||
language_hints=['zh','en'], # 中文和英文
|
||||
@@ -258,7 +258,7 @@ def text_correction(text):
|
||||
logger.info("调用通义千问模型进行文本修正...")
|
||||
# 调用DashScope文本生成接口
|
||||
response = Generation.call(
|
||||
model="qwen-plus",
|
||||
model=os.getenv('DASHSCOPE_LLM_MODEL', 'qwen-plus'),
|
||||
messages=messages,
|
||||
max_tokens=30000,
|
||||
temperature=0.1, # 使用较低的温度以提高确定性
|
||||
@@ -316,7 +316,7 @@ def analyze_text(text, prompt):
|
||||
logger.info("调用通义千问模型进行文本分析...")
|
||||
# 调用DashScope文本生成接口
|
||||
response = Generation.call(
|
||||
model="qwen-plus", # 使用通义千问Plus模型进行分析
|
||||
model=os.getenv('DASHSCOPE_LLM_MODEL', 'qwen-plus'),
|
||||
messages=messages,
|
||||
max_tokens=8190, # 控制生成文本的最大长度
|
||||
temperature=0.3, # 控制生成文本的确定性
|
||||
|
||||
@@ -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