修改推理模型地址
This commit is contained in:
parent
458dcb5c3f
commit
b48d5cc834
@ -281,17 +281,23 @@ class NegotiationViewSet(viewsets.ModelViewSet):
|
||||
|
||||
# 6. 调用大模型
|
||||
try:
|
||||
response = client.chat(
|
||||
model="deepseek-r1:70b",
|
||||
messages=messages,
|
||||
)
|
||||
ai_response, current_status_json = self.filter_ai_response(response['message']['content'])
|
||||
vllm_url = "http://localhost:9090/v1/chat/completions"
|
||||
payload = {
|
||||
# "model": "Qwen2.5-14B-Instruct",
|
||||
"messages": messages,
|
||||
"temperature": 0.2,
|
||||
"max_tokens": 2048
|
||||
}
|
||||
resp = requests.post(vllm_url, json=payload)
|
||||
resp.raise_for_status()
|
||||
response_json = resp.json()
|
||||
ai_content = response_json['choices'][0]['message']['content']
|
||||
ai_response, current_status_json = self.filter_ai_response(ai_content)
|
||||
|
||||
if negotiation.status == 'draft_ready':
|
||||
if current_status_json['is_resend_email']:
|
||||
if current_status_json and current_status_json.get('is_resend_email'):
|
||||
self._send_contract_to_email(negotiation)
|
||||
|
||||
# print("response: ", response['message']['content'])
|
||||
except Exception as e:
|
||||
return Response({"error": f"AI服务错误: {str(e)}"}, status=500)
|
||||
|
||||
@ -762,11 +768,19 @@ class CreatorSQLSearchAPI(APIView):
|
||||
"""
|
||||
|
||||
# 2. 让大模型生成SQL
|
||||
response = client.chat(
|
||||
model="qwen2.5:32b",
|
||||
messages=[{'role': 'user', 'content': prompt}],
|
||||
)
|
||||
sql = self._extract_sql(response['message']['content'])
|
||||
vllm_url = "http://localhost:9090/v1/chat/completions"
|
||||
payload = {
|
||||
# "model": "Qwen2.5-14B-Instruct",
|
||||
"messages": [
|
||||
{"role": "user", "content": prompt}
|
||||
],
|
||||
"temperature": 0.2,
|
||||
"max_tokens": 2048
|
||||
}
|
||||
resp = requests.post(vllm_url, json=payload)
|
||||
resp.raise_for_status()
|
||||
response_json = resp.json()
|
||||
sql = self._extract_sql(response_json['choices'][0]['message']['content'])
|
||||
|
||||
# 3. 校验SQL(只允许select,防止注入)
|
||||
if not sql.strip().lower().startswith('select'):
|
||||
|
Loading…
Reference in New Issue
Block a user