Use FastGPT app opener for greetings

This commit is contained in:
Xin Wang
2026-05-29 15:34:33 +08:00
parent ce3c384b00
commit 15c98f21fe
9 changed files with 30 additions and 50 deletions

View File

@@ -196,15 +196,17 @@ async def run_pipeline_with_serializer(
logger.info(f"{client_label} websocket client connected")
if config.agent.greeting_mode == "fixed" and config.agent.greeting:
await task.queue_frames([TTSSpeakFrame(config.agent.greeting)])
elif config.agent.greeting_mode == "generated":
elif config.agent.greeting_mode == "fastgpt_opener":
if isinstance(llm, FastGPTLLMService):
welcome = await llm.fetch_welcome_text()
if welcome:
await task.queue_frames([TTSSpeakFrame(welcome)])
else:
await task.queue_frames([LLMRunFrame()])
logger.warning("FastGPT opener requested but no opener text was returned")
else:
await task.queue_frames([LLMRunFrame()])
raise RuntimeError("agent.greeting_mode='fastgpt_opener' requires FastGPT LLM service")
elif config.agent.greeting_mode == "generated":
await task.queue_frames([LLMRunFrame()])
@transport.event_handler("on_client_disconnected")
async def on_client_disconnected(_transport, _client):