mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-09-24 15:36:23 +00:00
✨ 暗语初步支持 (#27)
This commit is contained in:
@ -16,7 +16,7 @@ async def process_chat_stream(
|
||||
last_chunk = chunk
|
||||
# print(chunk)
|
||||
if not is_first_token_appeared:
|
||||
logger.debug(f"{chunk.id}: 第一个 token 已出现")
|
||||
logger.info(f"{chunk.id}: 第一个 token 已出现")
|
||||
is_first_token_appeared = True
|
||||
if not chunk.choices:
|
||||
logger.info("Usage:", chunk.usage)
|
||||
@ -29,7 +29,7 @@ async def process_chat_stream(
|
||||
reasoning_contents += delta.reasoning_content
|
||||
else:
|
||||
if not is_answering:
|
||||
logger.debug(
|
||||
logger.info(
|
||||
f"{chunk.id}: 思维链已输出完毕或无 reasoning_content 字段输出"
|
||||
)
|
||||
is_answering = True
|
||||
@ -69,3 +69,19 @@ async def process_chat_stream(
|
||||
object="chat.completion",
|
||||
usage=None,
|
||||
)
|
||||
|
||||
|
||||
async def process_completion_to_details(completion: ChatCompletion) -> str:
|
||||
usage_text = ""
|
||||
usage = completion.usage
|
||||
if usage is None:
|
||||
usage_text = "无"
|
||||
else:
|
||||
usage_text = str(usage)
|
||||
|
||||
details_text = f"""=========消息详情=========
|
||||
模型: {completion.model}
|
||||
消息 ID: {completion.id}
|
||||
用量信息: {usage_text}"""
|
||||
# print(details_text)
|
||||
return details_text
|
||||
|
Reference in New Issue
Block a user