fix: 语音消息暂存本地 修复显示异常

This commit is contained in:
yangshilin
2026-03-13 17:11:59 +08:00
parent c0906723ac
commit a2b2b6eb76
13 changed files with 232 additions and 21 deletions

View File

@@ -195,7 +195,7 @@ async def get_messages(
"content": msg.get("content", ""),
"senderType": "user" if msg.get("role") == "human" else "assistant",
"timestamp": int(datetime.now(timezone.utc).timestamp() * 1000), # Redis中没有时间戳使用当前时间
"messageType": "text"
"messageType": msg.get("messageType", "text"), # 保留语音消息类型,使重新进入时仍显示为语音条
})
return messages
except Exception as e:

View File

@@ -928,12 +928,14 @@ async def process_user_message(
remaining = _get_missing_profile_fields(user)
filled = _get_filled_profile_fields(user)
is_from_voice = bool(segment.audio_url)
responses = await agent.generate_profile_followup(
conversation_id=conversation_id,
user_message=user_message,
missing_fields=remaining,
filled_fields=filled,
nickname=user.nickname or "",
is_from_voice=is_from_voice,
)
segment.agent_response = "\n\n".join(responses)
@@ -978,11 +980,13 @@ async def process_user_message(
)
try:
is_from_voice = bool(segment.audio_url)
responses = await agent.generate_response_with_state(
conversation_id=conversation_id,
user_message=user_message,
memoir_state=state,
user_profile_context=user_profile_context,
is_from_voice=is_from_voice,
)
segment.agent_response = "\n\n".join(responses)