AS AgentScopeAPI 手册 / API Reference

ChatController

@RestController @RequestMapping("/api") @CrossOrigin(origins = "*") public class ChatController
源码Source io/agentscope/examples/chattts/ChatController.java:50–215

聊天控制器,处理低延迟的实时语音与多模态交互。位于 io.agentscope.examples.chattts 包。核心成员包括 chat、ChatController。

Chat controller with real-time TTS streaming.

Provides SSE endpoint that streams both text and audio to frontend:

  • event: "text" - LLM generated text chunks

  • event: "audio" - Base64 encoded audio chunks

  • event: "done" - Stream completed

构造器摘要Constructor Summary

构造器Constructor说明Description
public ChatController()
创建新的ChatController。
Creates a new ChatController.

方法摘要Method Summary

方法Method说明Description
public Flux<ServerSentEvent<Map<String, Object>>> chat(Map<String, String> request)
设置聊天。
Chat endpoint with real-time TTS.

构造器详情Constructor Detail

ChatController

public ChatController()

创建新的ChatController。

Creates a new ChatController.

抛出Throws
  • IllegalStateException 当if DashScope_API_密钥是不设置时抛出 `IllegalStateException`。if DASHSCOPE_API_KEY is not set
源码Source io/agentscope/examples/chattts/ChatController.java:65–73

方法详情Method Detail

chat

public Flux<ServerSentEvent<Map<String, Object>>> chat(Map<String, String> request)

设置聊天。

Chat endpoint with real-time TTS.

参数Parameters
名称Name类型Type说明Description
requestMap<String, String>请求(类型 `Map`)。containing "message" field
返回Returns Flux<ServerSentEvent<Map<String, Object>>>
文本和音频的SSE 流。SSE stream of text and audio
源码Source io/agentscope/examples/chattts/ChatController.java:93–214
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.