mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-28 05:07:14 +00:00
feat: update eslint & prettier rules
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
"use client";
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import styles from "./botConfig.module.css";
|
||||
import EmptyAndCreateComponent from "@/app/home/components/empty-and-create-component/EmptyAndCreateComponent";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { BotCardVO } from "@/app/home/bots/components/bot-card/BotCardVO";
|
||||
import { Modal, notification, Spin } from "antd";
|
||||
import BotForm from "@/app/home/bots/components/bot-form/BotForm";
|
||||
import BotCard from "@/app/home/bots/components/bot-card/BotCard";
|
||||
import CreateCardComponent from "@/app/infra/basic-component/create-card-component/CreateCardComponent";
|
||||
import { httpClient } from "@/app/infra/http/HttpClient";
|
||||
import { Bot } from "@/app/infra/api/api-types";
|
||||
import { useEffect, useState } from 'react';
|
||||
import styles from './botConfig.module.css';
|
||||
import EmptyAndCreateComponent from '@/app/home/components/empty-and-create-component/EmptyAndCreateComponent';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { BotCardVO } from '@/app/home/bots/components/bot-card/BotCardVO';
|
||||
import { Modal, notification, Spin } from 'antd';
|
||||
import BotForm from '@/app/home/bots/components/bot-form/BotForm';
|
||||
import BotCard from '@/app/home/bots/components/bot-card/BotCard';
|
||||
import CreateCardComponent from '@/app/infra/basic-component/create-card-component/CreateCardComponent';
|
||||
import { httpClient } from '@/app/infra/http/HttpClient';
|
||||
import { Bot } from '@/app/infra/api/api-types';
|
||||
|
||||
export default function BotConfigPage() {
|
||||
const router = useRouter();
|
||||
const [pageShowRule, setPageShowRule] = useState<BotConfigPageShowRule>(
|
||||
BotConfigPageShowRule.NO_BOT
|
||||
BotConfigPageShowRule.NO_BOT,
|
||||
);
|
||||
const [modalOpen, setModalOpen] = useState<boolean>(false);
|
||||
const [botList, setBotList] = useState<BotCardVO[]>([]);
|
||||
@@ -49,10 +49,10 @@ export default function BotConfigPage() {
|
||||
return new BotCardVO({
|
||||
adapter: bot.adapter,
|
||||
description: bot.description,
|
||||
id: bot.uuid || "",
|
||||
id: bot.uuid || '',
|
||||
name: bot.name,
|
||||
updateTime: bot.updated_at || "",
|
||||
pipelineName: bot.use_pipeline_name || ""
|
||||
updateTime: bot.updated_at || '',
|
||||
pipelineName: bot.use_pipeline_name || '',
|
||||
});
|
||||
});
|
||||
if (botList.length === 0) {
|
||||
@@ -63,12 +63,12 @@ export default function BotConfigPage() {
|
||||
setBotList(botList);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("get bot list error", err);
|
||||
console.error('get bot list error', err);
|
||||
// TODO HACK: need refactor to hook mode Notification, but it's not working under render
|
||||
notification.error({
|
||||
message: "获取机器人列表失败",
|
||||
message: '获取机器人列表失败',
|
||||
description: err.message,
|
||||
placement: "bottomRight"
|
||||
placement: 'bottomRight',
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -89,7 +89,7 @@ export default function BotConfigPage() {
|
||||
function selectBot(cardVO: BotCardVO) {
|
||||
setIsEditForm(true);
|
||||
setNowSelectedCard(cardVO);
|
||||
console.log("set now vo", cardVO);
|
||||
console.log('set now vo', cardVO);
|
||||
setModalOpen(true);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ export default function BotConfigPage() {
|
||||
<div className={styles.configPageContainer}>
|
||||
<Spin spinning={isLoading} tip="加载中..." size="large">
|
||||
<Modal
|
||||
title={isEditForm ? "编辑机器人" : "创建机器人"}
|
||||
title={isEditForm ? '编辑机器人' : '创建机器人'}
|
||||
centered
|
||||
open={modalOpen}
|
||||
onOk={() => setModalOpen(false)}
|
||||
@@ -117,20 +117,20 @@ export default function BotConfigPage() {
|
||||
</Modal>
|
||||
{pageShowRule === BotConfigPageShowRule.NO_LLM && (
|
||||
<EmptyAndCreateComponent
|
||||
title={"需要先创建大模型才能配置机器人哦~"}
|
||||
subTitle={"快去创建一个吧!"}
|
||||
buttonText={"创建大模型 GO!"}
|
||||
title={'需要先创建大模型才能配置机器人哦~'}
|
||||
subTitle={'快去创建一个吧!'}
|
||||
buttonText={'创建大模型 GO!'}
|
||||
onButtonClick={() => {
|
||||
router.push("/home/models");
|
||||
router.push('/home/models');
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{pageShowRule === BotConfigPageShowRule.NO_BOT && (
|
||||
<EmptyAndCreateComponent
|
||||
title={"您还未配置机器人哦~"}
|
||||
subTitle={"快去创建一个吧!"}
|
||||
buttonText={"创建机器人 +"}
|
||||
title={'您还未配置机器人哦~'}
|
||||
subTitle={'快去创建一个吧!'}
|
||||
buttonText={'创建机器人 +'}
|
||||
onButtonClick={handleCreateBotClick}
|
||||
/>
|
||||
)}
|
||||
@@ -164,5 +164,5 @@ export default function BotConfigPage() {
|
||||
enum BotConfigPageShowRule {
|
||||
NO_LLM,
|
||||
NO_BOT,
|
||||
HAVE_BOT
|
||||
HAVE_BOT,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user