24#include "AstUtil/StringView.hpp"
25#include "AstUtil/JsonValue.hpp"
47AST_AI_API std::string toString(EChatRole role);
61 : role_(role), content_(content)
94 msg.setToolCalls(toolCalls);
122 void setName(
const std::string& name) { name_ = name; }
124 std::string
name()
const {
return name_; }
129 std::string
content()
const {
return content_; }
152 std::string content_;
153 std::string reasoningContent_;
154 std::string toolCallId_;
155 JsonValue toolCalls_;
聊天消息
定义 ChatMessage.hpp:52
static ChatMessage User(StringView content)
创建用户消息
定义 ChatMessage.hpp:78
void setToolCallId(StringView toolCallId)
设置工具调用ID
定义 ChatMessage.hpp:137
static ChatMessage Tool(StringView content, StringView toolCallId)
创建工具消息
定义 ChatMessage.hpp:104
ChatMessage(EChatRole role, StringView content)
构造函数
定义 ChatMessage.hpp:60
static ChatMessage Assistant(StringView content)
创建助手消息
定义 ChatMessage.hpp:86
void setRole(EChatRole role)
设置消息角色
定义 ChatMessage.hpp:117
std::string name() const
获取角色名称
定义 ChatMessage.hpp:124
void setToolCalls(const JsonValue &toolCalls)
设置工具调用列表
定义 ChatMessage.hpp:144
const JsonValue & toolCalls() const
获取工具调用列表
定义 ChatMessage.hpp:147
std::string reasoningContent() const
获取推理内容
定义 ChatMessage.hpp:134
EChatRole role() const
获取消息角色
定义 ChatMessage.hpp:119
static ChatMessage System(StringView content)
创建系统提示消息
定义 ChatMessage.hpp:70
std::string content() const
获取消息内容
定义 ChatMessage.hpp:129
std::string toolCallId() const
获取工具调用ID
定义 ChatMessage.hpp:140
void setName(const std::string &name)
设置角色名称
定义 ChatMessage.hpp:122
~ChatMessage()=default
析构函数
void setReasoningContent(StringView reasoningContent)
设置推理内容
定义 ChatMessage.hpp:132
void setContent(StringView content)
设置消息内容
定义 ChatMessage.hpp:127
ChatMessage()=default
构造函数
JSON 值类
定义 JsonValue.hpp:47
EChatRole
消息角色
定义 ChatMessage.hpp:39