diff --git a/web/src/app/home/bots/page.tsx b/web/src/app/home/bots/page.tsx index f9299672..1866d7c5 100644 --- a/web/src/app/home/bots/page.tsx +++ b/web/src/app/home/bots/page.tsx @@ -9,7 +9,7 @@ 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, Adapter } from '@/app/infra/api/api-types'; +import { Bot, Adapter } from '@/app/infra/entities/api'; import { Dialog, DialogContent, @@ -20,27 +20,14 @@ import { } from "@/components/ui/dialog" export default function BotConfigPage() { - const router = useRouter(); - const [pageShowRule, setPageShowRule] = useState( - BotConfigPageShowRule.NO_BOT, - ); const [modalOpen, setModalOpen] = useState(false); const [botList, setBotList] = useState([]); const [isEditForm, setIsEditForm] = useState(false); const [nowSelectedBotCard, setNowSelectedBotCard] = useState(); - const [isLoading, setIsLoading] = useState(false); useEffect(() => { // TODO:补齐加载转圈逻辑 - setIsLoading(true); - checkHasLLM().then((hasLLM) => { - if (hasLLM) { - getBotList(); - } else { - setPageShowRule(BotConfigPageShowRule.NO_LLM); - setIsLoading(false); - } - }); + }, []); async function checkHasLLM(): Promise { @@ -49,7 +36,6 @@ export default function BotConfigPage() { } async function getBotList() { - setIsLoading(true); const adapterListResp = await httpClient.getAdapters(); const adapterList = adapterListResp.adapters.map((adapter: Adapter) => { @@ -72,11 +58,6 @@ export default function BotConfigPage() { usePipelineName: bot.use_pipeline_name || '', }); }); - if (botList.length === 0) { - setPageShowRule(BotConfigPageShowRule.NO_BOT); - } else { - setPageShowRule(BotConfigPageShowRule.HAVE_BOT); - } setBotList(botList); }) .catch((err) => { @@ -89,7 +70,7 @@ export default function BotConfigPage() { // }); }) .finally(() => { - setIsLoading(false); + // setIsLoading(false); }); } @@ -136,7 +117,6 @@ export default function BotConfigPage() { {/* 注意:其余的返回内容需要保持在Spin组件外部 */} - {pageShowRule === BotConfigPageShowRule.HAVE_BOT && (
- )}
); } - -enum BotConfigPageShowRule { - NO_LLM, - NO_BOT, - HAVE_BOT, -} diff --git a/web/src/app/home/models/page.tsx b/web/src/app/home/models/page.tsx index 6c47470e..f0ca7f24 100644 --- a/web/src/app/home/models/page.tsx +++ b/web/src/app/home/models/page.tsx @@ -98,43 +98,27 @@ export default function LLMConfigPage() { /> +
- {cardList.length > 0 && ( -
- - - {cardList.map((cardVO) => { - return ( -
{ - selectLLM(cardVO); - }} - > - -
- ); - })} -
- )} - - {cardList.length === 0 && ( -
- { - handleCreateModelClick(); - }} - /> -
- )} + + {cardList.map((cardVO) => { + return ( +
{ + selectLLM(cardVO); + }} + > + +
+ ); + })} +
); } diff --git a/web/src/app/home/pipelines/page.tsx b/web/src/app/home/pipelines/page.tsx index 223ae3ef..9e15b7d8 100644 --- a/web/src/app/home/pipelines/page.tsx +++ b/web/src/app/home/pipelines/page.tsx @@ -43,9 +43,9 @@ export default function PluginConfigPage() { let currentTime = new Date(); const pipelineList = value.pipelines.map((pipeline) => { let lastUpdatedTimeAgo = Math.floor((currentTime.getTime() - new Date(pipeline.updated_at ?? currentTime.getTime()).getTime()) / 1000 / 60 / 60 / 24); - + let lastUpdatedTimeAgoText = lastUpdatedTimeAgo > 0 ? ` ${lastUpdatedTimeAgo} 天前` : '今天'; - + return new PipelineCardVO({ lastUpdatedTimeAgo: lastUpdatedTimeAgoText, description: pipeline.description, @@ -82,7 +82,7 @@ export default function PluginConfigPage() {
- + {isEditForm ? '编辑流水线' : '创建流水线'} @@ -109,38 +109,35 @@ export default function PluginConfigPage() {
- - {pipelineList.length > 0 && ( -
- { - setIsEditForm(false); - setModalOpen(true); - }} - /> +
+ { + setIsEditForm(false); + setModalOpen(true); + }} + /> - {pipelineList.map((pipeline) => { - return ( -
{ - setDisableForm(true); - setIsEditForm(true); - setModalOpen(true); - setSelectedPipelineId(pipeline.id); - getSelectedPipelineForm(pipeline.id); - }} - > - -
- ); - })} -
- )} + {pipelineList.map((pipeline) => { + return ( +
{ + setDisableForm(true); + setIsEditForm(true); + setModalOpen(true); + setSelectedPipelineId(pipeline.id); + getSelectedPipelineForm(pipeline.id); + }} + > + +
+ ); + })} +
); }