diff --git a/src/pages/chat-manager/history/List.tsx b/src/pages/chat-manager/history/List.tsx
new file mode 100644
index 0000000..bee6a7d
--- /dev/null
+++ b/src/pages/chat-manager/history/List.tsx
@@ -0,0 +1,24 @@
+import { useShallow } from 'zustand/react/shallow';
+import { useHistoryStore } from '../store/history';
+import { useEffect } from 'react';
+
+export const List = () => {
+ const historyStore = useHistoryStore(
+ useShallow((state) => {
+ return {
+ list: state.list,
+ getList: state.getList,
+ };
+ }),
+ );
+ useEffect(() => {
+ historyStore.getList();
+ }, []);
+ return (
+
+ {historyStore.list.map((item) => {
+ return
{item.id}
;
+ })}
+
+ );
+};
diff --git a/src/pages/chat-manager/index.tsx b/src/pages/chat-manager/index.tsx
new file mode 100644
index 0000000..43eb95e
--- /dev/null
+++ b/src/pages/chat-manager/index.tsx
@@ -0,0 +1,15 @@
+import { Navigate, Route, Routes } from 'react-router-dom';
+import { Main } from './layouts';
+import {List as HistoryList } from './history/List'
+
+export const App = () => {
+ return (
+
+ }>
+ }>
+ } />
+
+
+ );
+};
+
diff --git a/src/pages/chat-manager/layouts/index.tsx b/src/pages/chat-manager/layouts/index.tsx
new file mode 100644
index 0000000..d577ca8
--- /dev/null
+++ b/src/pages/chat-manager/layouts/index.tsx
@@ -0,0 +1,25 @@
+import { PlusOutlined } from '@ant-design/icons';
+import { Button } from 'antd';
+import { Outlet, useLocation } from 'react-router';
+import { useEffect } from 'react';
+import { LayoutMain } from '@/modules/layout';
+
+export const Main = () => {
+ const location = useLocation();
+ const isEdit = location.pathname.includes('edit/list');
+ return (
+
+ Chat
+ }
+ onClick={() => {
+ console.log('add');
+ }}
+ />
+ >
+ }>
+ );
+};
diff --git a/src/pages/chat-manager/store/history.ts b/src/pages/chat-manager/store/history.ts
new file mode 100644
index 0000000..77ad1cd
--- /dev/null
+++ b/src/pages/chat-manager/store/history.ts
@@ -0,0 +1,69 @@
+import { create } from 'zustand';
+import { query } from '@/modules';
+import { message } from 'antd';
+type HistoryStore = {
+ showEdit: boolean;
+ setShowEdit: (showEdit: boolean) => void;
+ formData: any;
+ setFormData: (formData: any) => void;
+ loading: boolean;
+ setLoading: (loading: boolean) => void;
+ list: any[];
+ getList: () => Promise
;
+ updateData: (data: any) => Promise;
+ deleteData: (id: string) => Promise;
+};
+export const useHistoryStore = create((set, get) => {
+ return {
+ showEdit: false,
+ setShowEdit: (showEdit) => set({ showEdit }),
+ formData: {},
+ setFormData: (formData) => set({ formData }),
+ loading: false,
+ setLoading: (loading) => set({ loading }),
+ list: [],
+ getList: async () => {
+ set({ loading: true });
+
+ const res = await query.post({
+ path: 'chat-history',
+ key: 'list',
+ });
+ set({ loading: false });
+ if (res.code === 200) {
+ set({ list: res.data });
+ } else {
+ message.error(res.message || 'Request failed');
+ }
+ },
+ updateData: async (data) => {
+ const { getList } = get();
+ const res = await query.post({
+ path: 'chat-history',
+ key: 'update',
+ data,
+ });
+ if (res.code === 200) {
+ message.success('Success');
+ set({ showEdit: false, formData: [] });
+ getList();
+ } else {
+ message.error(res.message || 'Request failed');
+ }
+ },
+ deleteData: async (id) => {
+ const { getList } = get();
+ const res = await query.post({
+ path: 'chat-history',
+ key: 'delete',
+ id,
+ });
+ if (res.code === 200) {
+ getList();
+ message.success('Success');
+ } else {
+ message.error(res.message || 'Request failed');
+ }
+ },
+ };
+});
diff --git a/src/pages/chat-manager/store/session.ts b/src/pages/chat-manager/store/session.ts
new file mode 100644
index 0000000..39f0bdb
--- /dev/null
+++ b/src/pages/chat-manager/store/session.ts
@@ -0,0 +1,68 @@
+import { create } from 'zustand';
+import { query } from '@/modules';
+import { message } from 'antd';
+type SessionStore = {
+ showEdit: boolean;
+ setShowEdit: (showEdit: boolean) => void;
+ formData: any;
+ setFormData: (formData: any) => void;
+ loading: boolean;
+ setLoading: (loading: boolean) => void;
+ list: any[];
+ getList: () => Promise;
+ updateData: (data: any) => Promise;
+ deleteData: (id: string) => Promise;
+};
+export const useSessionStore = create((set, get) => {
+ return {
+ showEdit: false,
+ setShowEdit: (showEdit) => set({ showEdit }),
+ formData: {},
+ setFormData: (formData) => set({ formData }),
+ loading: false,
+ setLoading: (loading) => set({ loading }),
+ list: [],
+ getList: async () => {
+ set({ loading: true });
+ const res = await query.post({
+ path: 'chat-session',
+ key: 'list',
+ });
+ set({ loading: false });
+ if (res.code === 200) {
+ set({ list: res.data });
+ } else {
+ message.error(res.message || 'Request failed');
+ }
+ },
+ updateData: async (data) => {
+ const { getList } = get();
+ const res = await query.post({
+ path: 'chat-session',
+ key: 'update',
+ data,
+ });
+ if (res.code === 200) {
+ message.success('Success');
+ set({ showEdit: false, formData: [] });
+ getList();
+ } else {
+ message.error(res.message || 'Request failed');
+ }
+ },
+ deleteData: async (id) => {
+ const { getList } = get();
+ const res = await query.post({
+ path: 'chat-session',
+ key: 'delete',
+ id,
+ });
+ if (res.code === 200) {
+ getList();
+ message.success('Success');
+ } else {
+ message.error(res.message || 'Request failed');
+ }
+ },
+ };
+});
diff --git a/src/pages/container/edit/List.tsx b/src/pages/container/edit/List.tsx
index dea47d7..6ccf2d2 100644
--- a/src/pages/container/edit/List.tsx
+++ b/src/pages/container/edit/List.tsx
@@ -10,6 +10,7 @@ import { EditOutlined, SettingOutlined, LinkOutlined, SaveOutlined, DeleteOutlin
import clsx from 'clsx';
import { isObjectNull } from '@/utils/is-null';
import { CardBlank } from '@/components/card/CardBlank';
+import { useAiStore } from '@/pages/ai-chat';
const FormModal = () => {
const [form] = Form.useForm();
const containerStore = useContainerStore(
@@ -103,6 +104,15 @@ export const ContainerList = () => {
};
}),
);
+ const aiStore = useAiStore(
+ useShallow((state) => {
+ return {
+ open: state.open,
+ setOpen: state.setOpen,
+ setData: state.setData,
+ };
+ }),
+ );
const [codeEdit, setCodeEdit] = useState(false);
const [code, setCode] = useState('');
useEffect(() => {
@@ -212,7 +222,12 @@ export const ContainerList = () => {
icon={}>
-
+