import { View } from "@tarojs/components"; import RoundedLabel from "../RoundedLabel"; import IconFilterFeeds from "@/components/icon/IconFilterFeeds"; import IconFilterBatch from "@/components/icon/IconFilterBatch"; import IconFilterList from "@/components/icon/IconFilterList"; import EmptyData from "@/components/empty-data"; import Popup from "@/components/popup/popup"; import WemetaSwitch from "@/components/WemetaSwitch"; import { useState } from "react"; import ViewStyleChatEnt from "../view-style/ViewStyleChatEnt"; import ViewStyleListEnt from "../view-style/ViewStyleListEnt"; import PickerSingleColumn from "@/components/Picker/PickerSingleColumn"; import IconArrowDownRounded from "@/components/icon/IconArrowDownRounded"; import { useKnowledgeEntStore } from "@/store/knowledgeEnt"; import { useUserStore } from "@/store/userStore"; import { useAgentStore } from "@/store/agentStore"; type TListStyle = "chat" | "list"; const Index = () => { const ents = useUserStore((state) => state.entList); const [checked, setChecked] = useState(false); const [showPopup, setShowPopup] = useState(false); const [listStyle, setListStyle] = useState("chat"); const { ent, setEnt, total, listTotalCount } = useKnowledgeEntStore(); // const agents = useAgentStore((state) => state.agents); const handleListStyleChange = (listStyle: TListStyle) => { setListStyle(listStyle); }; // 如果没有当前企业,则默认第一个 if (!ent) { setEnt(ents[0]); } const renderTabContent = () => { if (!ents.length) { return ( 绑定企业,知识自动到位 访问公司统一知识内容 一键同步到你的智能体 提升回复效率与专业度 Taro.navigateTo({ url: "/pages/contact-us/index" }) } > 联系我们 ); } return ( <> setShowPicker(true)} > {selected} 共 {listStyle === "chat" ? total : listTotalCount} 个文件 {listStyle === "chat" ? ( setShowPopup(true)} text="信息流" icon={IconFilterFeeds} > ) : ( <> { console.log("batch"); }} text="批量" icon={IconFilterBatch} > { setShowPopup(true); }} icon={IconFilterList} > )} {renderContent()} ); }; // 当前选中的值 const options = ents.map((item) => item.entName); // 是否显示选择器 const [showPicker, setShowPicker] = useState(false); // 当前选中的值 const [selected, setSelected] = useState(options[0]); const handleChange = (value: string) => { setSelected(value); const ent = ents.find((item) => item.entName === value); if (ent) { setEnt(ent); } }; const renderContent = () => { if (!ent?.entId) { return <>; } if (listStyle === "chat") { return ; } return ; }; return ( <> {renderTabContent()} { handleListStyleChange("chat"); }} > 对话信息流 以对话形式展示,模拟自然的对话流程。 仅显示 AI 助手信息 setChecked(checked)} > { handleListStyleChange("list"); }} > 列表形式 将知识点以简洁列表呈现,清晰快速地提供信息。 ); }; export default Index;