🛰️航天仿真算法库 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
58
UiChatWorker
(
const
UiChatWorker
&) =
delete
;
59
UiChatWorker
& operator=(
const
UiChatWorker
&) =
delete
;
60
62
const
std::string&
response
()
const
{
return
response_; }
63
65
int
errorCode
()
const
{
return
errorCode_; }
66
67
Q_SIGNALS:
70
void
workFinished
(
int
errorCode);
71
72
protected
:
73
void
run()
override
;
74
75
private
:
76
ChatSession
* session_;
77
QString userMessage_;
78
QPointer<UiChatEventHandler> handler_;
79
int
maxToolIterations_;
80
std::string response_{};
81
int
errorCode_{0};
82
};
83
86
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:65
ast::UiChatWorker::response
const std::string & response() const
获取本轮对话的最终响应
定义
UiChatWorker.hpp:62
src
AstUiAI
Chat
UiChatWorker.hpp
制作者
1.12.0