🛰️航天仿真算法库 SpaceAST
0.0.1
载入中...
搜索中...
未找到
UiChatWorker.hpp
浏览该文件的文档.
1
12
13
#pragma once
14
15
#include "AstGlobal.h"
16
#include <QThread>
17
#include <QString>
18
#include <QPointer>
19
#include <memory>
20
21
AST_NAMESPACE_BEGIN
22
23
class
ChatSession;
24
class
UiChatEventHandler;
25
39
class
AST_UIAI_API
UiChatWorker
:
public
QThread
40
{
41
Q_OBJECT
42
43
public
:
50
explicit
UiChatWorker
(
ChatSession
* session,
51
const
QString& userMessage,
52
UiChatEventHandler
* handler,
53
int
maxToolIterations = 100,
54
QObject* parent =
nullptr
);
55
56
~UiChatWorker
()
override
;
57
59
const
std::string&
response
()
const
{
return
response_; }
60
62
int
errorCode
()
const
{
return
errorCode_; }
63
64
Q_SIGNALS:
67
void
workFinished
(
int
errorCode);
68
69
protected
:
70
void
run()
override
;
71
72
private
:
73
ChatSession
* session_;
74
QString userMessage_;
75
QPointer<UiChatEventHandler> handler_;
76
int
maxToolIterations_;
77
std::string response_;
78
int
errorCode_{0};
79
};
80
83
AST_NAMESPACE_END
ast::ChatSession
聊天会话
定义
ChatSession.hpp:44
ast::UiChatEventHandler
流式聊天事件的 Qt 信号桥接器
定义
UiChatEventHandler.hpp:44
ast::UiChatWorker
后台 LLM 对话工作线程
定义
UiChatWorker.hpp:40
ast::UiChatWorker::workFinished
void workFinished(int errorCode)
工作完成
ast::UiChatWorker::errorCode
int errorCode() const
获取错误码
定义
UiChatWorker.hpp:62
ast::UiChatWorker::response
const std::string & response() const
获取本轮对话的最终响应
定义
UiChatWorker.hpp:59
src
AstUiAI
Chat
UiChatWorker.hpp
制作者
1.12.0