feat: event log of bots (#1441)

* feat: basic arch of event log

* feat: complete event log framework

* fix: bad struct in bot log api

* feat: add event logging to all platform adapters

Co-Authored-By: wangcham233@gmail.com <651122857@qq.com>

* feat: add event logging to client classes

Co-Authored-By: wangcham233@gmail.com <651122857@qq.com>

* refactor: bot log getting api

* perf: logger for aiocqhttp and gewechat

* fix: add ignored logger in dingtalk

* fix: seq id bug in log getting

* feat: add logger in dingtalk,QQ official,Slack, wxoa

* feat: add logger for wecom

* feat: add logger for wecomcs

* perf(event logger): image processing

* 完成机器人日志的前端部分 (#1479)

* feat: webui  bot log framework done

* feat: bot log complete

* perf(bot-log): style

* chore: fix incompleted i18n

* feat: support message session copy

* fix: filter and badge text

* perf: styles

* feat: add bot toggle switch in bot card

* fix: linter errors

---------

Co-authored-by: Junyan Qin <rockchinq@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: wangcham233@gmail.com <651122857@qq.com>
Co-authored-by: HYana <65863826+KaedeSAMA@users.noreply.github.com>
This commit is contained in:
Junyan Qin (Chin)
2025-05-27 22:36:50 +08:00
committed by GitHub
parent 8dfef1d118
commit f1e9f46af1
55 changed files with 1196 additions and 136 deletions
+18 -13
View File
@@ -30,6 +30,8 @@ import {
GetPipelineMetadataResponseData,
AsyncTask,
} from '@/app/infra/entities/api';
import { GetBotLogsRequest } from '@/app/infra/http/requestParam/bots/GetBotLogsRequest';
import { GetBotLogsResponse } from '@/app/infra/http/requestParam/bots/GetBotLogsResponse';
type JSONValue = string | number | boolean | JSONObject | JSONArray | null;
interface JSONObject {
@@ -54,12 +56,14 @@ export let systemInfo: ApiRespSystemInfo | null = null;
class HttpClient {
private instance: AxiosInstance;
private disableToken: boolean = false;
private baseURL: string;
// 暂不需要SSR
// private ssrInstance: AxiosInstance | null = null
constructor(baseURL?: string, disableToken?: boolean) {
constructor(baseURL: string, disableToken?: boolean) {
this.baseURL = baseURL;
this.instance = axios.create({
baseURL: baseURL || this.getBaseUrl(),
baseURL: baseURL,
timeout: 15000,
headers: {
'Content-Type': 'application/json',
@@ -75,15 +79,9 @@ class HttpClient {
}
}
// 兜底URL,如果使用未配置会走到这里
private getBaseUrl(): string {
// NOT IMPLEMENT
if (typeof window === 'undefined') {
// 服务端环境
return '';
}
// 客户端环境
return '';
// 外部获取baseURL的方法
getBaseUrl(): string {
return this.baseURL;
}
// 获取Session
@@ -345,6 +343,13 @@ class HttpClient {
return this.delete(`/api/v1/platform/bots/${uuid}`);
}
public getBotLogs(
botId: string,
request: GetBotLogsRequest,
): Promise<GetBotLogsResponse> {
return this.post(`/api/v1/platform/bots/${botId}/logs`, request);
}
// ============ Plugins API ============
public getPlugins(): Promise<ApiRespPlugins> {
return this.get('/api/v1/plugins');
@@ -450,9 +455,9 @@ class HttpClient {
}
}
// export const httpClient = new HttpClient("https://version-4.langbot.dev");
export const httpClient = new HttpClient('https://event-log.langbot.dev');
// export const httpClient = new HttpClient('http://localhost:5300');
export const httpClient = new HttpClient('/');
// export const httpClient = new HttpClient('/');
// 临时写法,未来两种Client都继承自HttpClient父类,不允许共享方法
export const spaceClient = new HttpClient('https://space.langbot.app');