🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::ChatEventHandler类 参考

#include <ChatEventHandler.hpp>

+ 类 ast::ChatEventHandler 继承关系图:

Public 成员函数

virtual void onContentChunk (const std::string &text)
 
virtual void onContentComplete (const std::string &text)
 
virtual void onReasoningChunk (const std::string &reasoning)
 
virtual void onReasoningComplete (const std::string &reasoning)
 
virtual void onToolCallRequest (const std::string &toolCallId, const std::string &functionName, const std::string &arguments)
 
virtual void onToolCallResult (const std::string &toolCallId, const std::string &functionName, const std::string &result)
 
virtual void onComplete ()
 
virtual void onError (const std::string &error)
 
virtual bool isCancelled () const
 

详细描述

流式聊天事件处理器

纯虚接口,所有方法均有空默认体。子类按需重写。

成员函数说明

◆ isCancelled()

virtual bool ast::ChatEventHandler::isCancelled ( ) const
inlinevirtual

检查是否被取消

返回
true 表示取消当前操作

ast::UiChatEventHandler 重载.

◆ onComplete()

virtual void ast::ChatEventHandler::onComplete ( )
inlinevirtual

本轮对话完成

ast::ChatConsole , 以及 ast::UiChatEventHandler 重载.

◆ onContentChunk()

virtual void ast::ChatEventHandler::onContentChunk ( const std::string & text)
inlinevirtual

收到一块文本内容(delta)

参数
text文本增量(可能是一个或几个 token)

ast::ChatConsole , 以及 ast::UiChatEventHandler 重载.

◆ onContentComplete()

virtual void ast::ChatEventHandler::onContentComplete ( const std::string & text)
inlinevirtual

收到完整文本内容

ast::UiChatEventHandler 重载.

◆ onError()

virtual void ast::ChatEventHandler::onError ( const std::string & error)
inlinevirtual

发生错误

参数
error错误描述

ast::ChatConsole , 以及 ast::UiChatEventHandler 重载.

◆ onReasoningChunk()

virtual void ast::ChatEventHandler::onReasoningChunk ( const std::string & reasoning)
inlinevirtual

收到一块推理内容(delta)

参数
reasoning推理内容增量

ast::ChatConsole , 以及 ast::UiChatEventHandler 重载.

◆ onReasoningComplete()

virtual void ast::ChatEventHandler::onReasoningComplete ( const std::string & reasoning)
inlinevirtual

收到完整推理内容

参数
reasoning推理内容

ast::UiChatEventHandler 重载.

◆ onToolCallRequest()

virtual void ast::ChatEventHandler::onToolCallRequest ( const std::string & toolCallId,
const std::string & functionName,
const std::string & arguments )
inlinevirtual

LLM 请求调用工具(含完整函数名和参数)

参数
toolCallId工具调用 ID
functionName函数名称
arguments参数字符串(JSON 格式)

ast::ChatConsole , 以及 ast::UiChatEventHandler 重载.

◆ onToolCallResult()

virtual void ast::ChatEventHandler::onToolCallResult ( const std::string & toolCallId,
const std::string & functionName,
const std::string & result )
inlinevirtual

工具执行完毕,返回结果

参数
toolCallId工具调用 ID
functionName函数名称
result执行结果字符串

ast::ChatConsole , 以及 ast::UiChatEventHandler 重载.


该类的文档由以下文件生成: