调整 AI 模型不要思考,以及添加 Wolfx 日志详细程度
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
@ -4,7 +4,7 @@ Wolfx 防灾免费 API
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
from typing import Literal, TypeVar, cast
|
from typing import TypeVar, cast
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from aiosignal import Signal
|
from aiosignal import Signal
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
@ -239,7 +239,8 @@ class WolfxAPIService:
|
|||||||
logger.info(f"接收到来自 Wolfx API 的信息:{data}")
|
logger.info(f"接收到来自 Wolfx API 的信息:{data}")
|
||||||
await signal.send(obj)
|
await signal.send(obj)
|
||||||
except pydantic.ValidationError as e:
|
except pydantic.ValidationError as e:
|
||||||
logger.warning(f"解析 Wolfx API 时出错 URL={ws.url}")
|
data_text = data.decode('utf-8', 'replace')
|
||||||
|
logger.warning(f"解析 Wolfx API 时出错 URL={ws.url} raw={data_text}")
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
|
|
||||||
async def start(self): # pragma: no cover
|
async def start(self): # pragma: no cover
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class THQwen(TextHandler):
|
|||||||
ostream="你或当前环境没有使用 qwen 的权限。如有疑问请联系管理员",
|
ostream="你或当前环境没有使用 qwen 的权限。如有疑问请联系管理员",
|
||||||
)
|
)
|
||||||
|
|
||||||
llm = get_llm()
|
llm = get_llm(llm_model="qwen3.7-plus")
|
||||||
messages = []
|
messages = []
|
||||||
|
|
||||||
if istream is not None:
|
if istream is not None:
|
||||||
@ -48,7 +48,9 @@ class THQwen(TextHandler):
|
|||||||
"content": "除非用户要求,请尽可能短点回答。另外,当前环境不支持 Markdown 语法,如果可以,请使用纯文本回答",
|
"content": "除非用户要求,请尽可能短点回答。另外,当前环境不支持 Markdown 语法,如果可以,请使用纯文本回答",
|
||||||
}
|
}
|
||||||
] + messages
|
] + messages
|
||||||
result = await llm.chat(cast(Any, messages))
|
result = await llm.chat(
|
||||||
|
cast(Any, messages), extra_body={"enable_thinking": False}
|
||||||
|
)
|
||||||
content = result.content
|
content = result.content
|
||||||
if content is None:
|
if content is None:
|
||||||
return TextHandleResult(
|
return TextHandleResult(
|
||||||
|
|||||||
Reference in New Issue
Block a user