mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-31 06:37:14 +00:00
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:
committed by
GitHub
parent
8dfef1d118
commit
f1e9f46af1
@@ -17,13 +17,18 @@ import {
|
||||
import { toast } from 'sonner';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { i18nObj } from '@/i18n/I18nProvider';
|
||||
import { BotLogListComponent } from '@/app/home/bots/bot-log/view/BotLogListComponent';
|
||||
|
||||
export default function BotConfigPage() {
|
||||
const { t } = useTranslation();
|
||||
// 编辑机器人的modal
|
||||
const [modalOpen, setModalOpen] = useState<boolean>(false);
|
||||
// 机器人日志的modal
|
||||
const [logModalOpen, setLogModalOpen] = useState<boolean>(false);
|
||||
const [botList, setBotList] = useState<BotCardVO[]>([]);
|
||||
const [isEditForm, setIsEditForm] = useState(false);
|
||||
const [nowSelectedBotUUID, setNowSelectedBotUUID] = useState<string>();
|
||||
const [nowSelectedBotLog, setNowSelectedBotLog] = useState<string>();
|
||||
|
||||
useEffect(() => {
|
||||
getBotList();
|
||||
@@ -47,10 +52,13 @@ export default function BotConfigPage() {
|
||||
iconURL: httpClient.getAdapterIconURL(bot.adapter),
|
||||
name: bot.name,
|
||||
description: bot.description,
|
||||
adapter: bot.adapter,
|
||||
adapterConfig: bot.adapter_config,
|
||||
adapterLabel:
|
||||
adapterList.find((item) => item.value === bot.adapter)?.label ||
|
||||
bot.adapter.substring(0, 10),
|
||||
usePipelineName: bot.use_pipeline_name || '',
|
||||
enable: bot.enable || false,
|
||||
});
|
||||
});
|
||||
setBotList(botList);
|
||||
@@ -76,6 +84,11 @@ export default function BotConfigPage() {
|
||||
setModalOpen(true);
|
||||
}
|
||||
|
||||
function onClickLogIcon(botId: string) {
|
||||
setNowSelectedBotLog(botId);
|
||||
setLogModalOpen(true);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.configPageContainer}>
|
||||
<Dialog open={modalOpen} onOpenChange={setModalOpen}>
|
||||
@@ -107,6 +120,15 @@ export default function BotConfigPage() {
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<Dialog open={logModalOpen} onOpenChange={setLogModalOpen}>
|
||||
<DialogContent className="w-[700px] max-h-[80vh] p-0 flex flex-col">
|
||||
<DialogHeader className="px-6 pt-6 pb-0">
|
||||
<DialogTitle>{t('bots.botLogTitle')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<BotLogListComponent botId={nowSelectedBotLog || ''} />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
{/* 注意:其余的返回内容需要保持在Spin组件外部 */}
|
||||
<div className={`${styles.botListContainer}`}>
|
||||
<CreateCardComponent
|
||||
@@ -123,7 +145,22 @@ export default function BotConfigPage() {
|
||||
selectBot(cardVO.id);
|
||||
}}
|
||||
>
|
||||
<BotCard botCardVO={cardVO} />
|
||||
<BotCard
|
||||
botCardVO={cardVO}
|
||||
clickLogIconCallback={(id) => {
|
||||
onClickLogIcon(id);
|
||||
}}
|
||||
setBotEnableCallback={(id, enable) => {
|
||||
setBotList(
|
||||
botList.map((bot) => {
|
||||
if (bot.id === id) {
|
||||
return { ...bot, enable: enable };
|
||||
}
|
||||
return bot;
|
||||
}),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user