feat(conversation): push topic chips after each assistant turn
- Extract maybe_send_topic_chips_ws for WS connect + pipeline reuse - Default memoir stage to childhood when empty for chip bank lookup - Resend suggestions after normal assistant reply (English/Chinese) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -45,6 +45,8 @@ from app.features.conversation.ws.profile_collector import (
|
||||
get_filled_profile_fields,
|
||||
get_missing_profile_fields,
|
||||
)
|
||||
from app.features.conversation.ws.topic_chips_push import maybe_send_topic_chips_ws
|
||||
from app.features.memoir.state_service import get_or_create_state
|
||||
from app.features.memoir.background_runner import BackgroundTaskRunner
|
||||
from app.features.memoir.ingest_scheduler import MemoirIngestScheduler
|
||||
from app.features.user.models import User
|
||||
@@ -1107,6 +1109,19 @@ async def process_user_message(
|
||||
if i < n - 1:
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
if user is not None:
|
||||
try:
|
||||
fresh_memoir = await get_or_create_state(user.id, db)
|
||||
await maybe_send_topic_chips_ws(
|
||||
conversation_id,
|
||||
user=user,
|
||||
memoir_state=fresh_memoir,
|
||||
reason="after_assistant_turn",
|
||||
language=user_language,
|
||||
)
|
||||
except Exception as chip_err:
|
||||
logger.warning("after-turn topic chips skipped: {}", chip_err)
|
||||
|
||||
if tts_urls:
|
||||
await store.attach_ai_tts_audio_urls(
|
||||
conversation_id,
|
||||
|
||||
Reference in New Issue
Block a user