-
- {t('chat.chooseOne')}{t('chat.dialogue')} {t('chat.start')}{t('chat.wenqingruijian')}
+
+ {t('chat.chooseOne')}{t('chat.dialogue')} {t('chat.start')}{t('chat.wenqingruijian')}
{
!customWsHost &&
{
document.getElementById('newchat')?.click()
}}>
diff --git a/src/frontend/src/pages/ChatAppPage/index.tsx b/src/frontend/src/pages/ChatAppPage/index.tsx
index 3c5d07f61..c0ab48952 100755
--- a/src/frontend/src/pages/ChatAppPage/index.tsx
+++ b/src/frontend/src/pages/ChatAppPage/index.tsx
@@ -102,7 +102,7 @@ export default function SkillChatPage() {
{chat.flow_type === 'assistant' ?
:
}
-
{chat.flow_name}
+
{chat.flow_name}
{chat.latest_message?.message || ''}
diff --git a/src/frontend/src/pages/FileLibPage/index.tsx b/src/frontend/src/pages/FileLibPage/index.tsx
index 7c19c2f44..b99738b58 100755
--- a/src/frontend/src/pages/FileLibPage/index.tsx
+++ b/src/frontend/src/pages/FileLibPage/index.tsx
@@ -203,7 +203,7 @@ export default function FileLibPage() {
// @ts-ignore
window.libname = el.name;
}}>
- {t('lib.details')}
+ {t('lib.details')}
{user.role === 'admin' || user.user_id === el.user_id ?
handleDelete(el.id)} className="ml-4 text-red-500 px-0">{t('delete')} :
{t('delete')}
diff --git a/src/frontend/src/pages/SkillPage/editAssistant.tsx b/src/frontend/src/pages/SkillPage/editAssistant.tsx
index 2b5b68d7c..424fb07aa 100644
--- a/src/frontend/src/pages/SkillPage/editAssistant.tsx
+++ b/src/frontend/src/pages/SkillPage/editAssistant.tsx
@@ -21,7 +21,7 @@ export default function editAssistant() {
const { startNewRound, insetSystemMsg, insetBsMsg, setShowGuideQuestion } = useMessageStore()
useEffect(() => {
- loadAssistantState(assisId).then((res) => {
+ loadAssistantState(assisId, 'v1').then((res) => {
setShowGuideQuestion(true)
setGuideQuestion(res.guide_question?.filter((item) => item) || [])
res.guide_word && insetBsMsg(res.guide_word)
diff --git a/src/frontend/src/pages/SystemPage/index.tsx b/src/frontend/src/pages/SystemPage/index.tsx
index 7f11d6812..a58c001e7 100644
--- a/src/frontend/src/pages/SystemPage/index.tsx
+++ b/src/frontend/src/pages/SystemPage/index.tsx
@@ -1,16 +1,17 @@
+import { userContext } from "@/contexts/userContext";
+import { useContext } from "react";
+import { useTranslation } from "react-i18next";
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from "../../components/bs-ui/tabs";
-import Roles from "./components/Roles";
import Config from "./components/Config";
-import Users from "./components/Users";
-import { useTranslation } from "react-i18next";
+import Roles from "./components/Roles";
+import Theme from "./theme";
import UserGroups from "./components/UserGroup";
-import { userContext } from "@/contexts/userContext";
-import { useContext } from "react";
+import Users from "./components/Users";
export default function FileLibPage() {
const { user } = useContext(userContext);
@@ -24,9 +25,9 @@ export default function FileLibPage() {
{user.role === 'admin' && {t('system.userGroupsM')} }
{t('system.roleManagement')}
{user.role === 'admin' && {t('system.systemConfiguration')} }
+ 主题配置
-
@@ -38,6 +39,9 @@ export default function FileLibPage() {
+
+
+
};
diff --git a/src/frontend/src/pages/SystemPage/theme/Example.tsx b/src/frontend/src/pages/SystemPage/theme/Example.tsx
new file mode 100644
index 000000000..563168303
--- /dev/null
+++ b/src/frontend/src/pages/SystemPage/theme/Example.tsx
@@ -0,0 +1,185 @@
+import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/bs-ui/accordion";
+import { Badge } from "@/components/bs-ui/badge";
+import { Button } from "@/components/bs-ui/button";
+import { Calendar } from "@/components/bs-ui/calendar";
+import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/bs-ui/card";
+import { Checkbox } from "@/components/bs-ui/checkBox";
+import { SearchInput, Textarea } from "@/components/bs-ui/input";
+import { Label } from "@/components/bs-ui/label";
+import AutoPagination from "@/components/bs-ui/pagination/autoPagination";
+import { RadioGroup, RadioGroupItem } from "@/components/bs-ui/radio";
+import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "@/components/bs-ui/select";
+import { Slider } from "@/components/bs-ui/slider";
+import { Switch } from "@/components/bs-ui/switch";
+import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "@/components/bs-ui/table";
+
+const invoices = [
+ {
+ invoice: "INV001",
+ paymentStatus: "Paid",
+ totalAmount: "$250.00",
+ paymentMethod: "Credit Card",
+ },
+ {
+ invoice: "INV002",
+ paymentStatus: "Pending",
+ totalAmount: "$150.00",
+ paymentMethod: "PayPal",
+ },
+ {
+ invoice: "INV003",
+ paymentStatus: "Unpaid",
+ totalAmount: "$350.00",
+ paymentMethod: "Bank Transfer",
+ },
+]
+
+export default function Example(params) {
+
+ return
+
按钮
+
+ Button
+ Button
+ Button
+ Button
+ Button
+ Button
+
+
徽章
+
+ Badge
+ Badge
+ Badge
+ Badge
+
+
输入框
+
+
下拉框
+
+
+
+
+
+
+
+ Fruits
+ Apple
+ Banana
+ Blueberry
+ Grapes
+ Pineapple
+
+
+
+
+
滑块
+
+
+
+
switch
+
+
+
+
单选多选
+
+
+
+
+
+ Default
+
+
+
+ one
+
+
+
+
表格&分页
+
+
+ A list of your recent invoices.
+
+
+ Invoice
+ Status
+ Method
+ Amount
+
+
+
+ {invoices.map((invoice) => (
+
+ {invoice.invoice}
+ {invoice.paymentStatus}
+ {invoice.paymentMethod}
+ {invoice.totalAmount}
+
+ ))}
+
+
+
+ Total
+ $2,500.00
+
+
+
+
+
+
日历
+
+
+
+
卡片
+
+
+
+ Create project
+ Deploy your new project in one-click.
+
+
+ 内容
+
+
+ Cancel
+ Deploy
+
+
+
+
手风琴
+
+
+
+ Is it accessible?
+
+ Yes. It adheres to the WAI-ARIA design pattern.
+
+
+
+ Is it styled?
+
+ Yes. It comes with default styles that matches the other
+ components' aesthetic.
+
+
+
+ Is it animated?
+
+ Yes. It's animated by default, but you can disable it if you prefer.
+
+
+
+
+
+};
diff --git a/src/frontend/src/pages/SystemPage/theme/HSLitem.tsx b/src/frontend/src/pages/SystemPage/theme/HSLitem.tsx
new file mode 100644
index 000000000..91a2b152e
--- /dev/null
+++ b/src/frontend/src/pages/SystemPage/theme/HSLitem.tsx
@@ -0,0 +1,21 @@
+import { Button } from "@/components/bs-ui/button";
+import { Label } from "@/components/bs-ui/label";
+import { useState } from "react";
+import { BlockPicker } from 'react-color';
+
+export default function HSLitem({ label, name, value, onChange }) {
+ const [show, setShow] = useState(false)
+
+ return
+
{label}
+
+
setShow(!show)}>
+
+
+ {show &&
+
setShow(false)}>
+
{ onChange(name, e.hsl), setShow(false) }} />
+ }
+
+
+};
diff --git a/src/frontend/src/pages/SystemPage/theme/index.tsx b/src/frontend/src/pages/SystemPage/theme/index.tsx
new file mode 100644
index 000000000..0a43b673e
--- /dev/null
+++ b/src/frontend/src/pages/SystemPage/theme/index.tsx
@@ -0,0 +1,109 @@
+import { useState } from "react";
+import HSLitem from "./HSLitem";
+import Example from "./Example";
+import { Button } from "@/components/bs-ui/button";
+import { LoadIcon } from "@/components/bs-icons";
+import { ReloadIcon } from "@radix-ui/react-icons";
+import { saveThemeApi } from "@/controllers/API";
+
+const defaultTheme = {
+ '--background': { h: 0, s: 0, l: 1 },
+ '--foreground': { h: 222.2, s: 0.474, l: 0.112 },
+ '--muted': { h: 210, s: 0.4, l: 0.98 },
+ '--muted-foreground': { h: 215.4, s: 0.163, l: 0.469 },
+ '--popover': { h: 0, s: 0, l: 1 },
+ '--popover-foreground': { h: 222.2, s: 0.474, l: 0.112 },
+ '--card': { h: 0, s: 0, l: 1 },
+ '--card-foreground': { h: 222.2, s: 0.474, l: 0.112 },
+ '--border': { h: 214.3, s: 0.218, l: 0.914 },
+ '--input': { h: 223, s: 0.48, l: 0.44 },
+ '--primary': { h: 220, s: 0.98, l: 0.45 },
+ '--primary-foreground': { h: 210, s: 0.4, l: 0.98 },
+ '--secondary': { h: 210, s: 0.4, l: 0.961 },
+ '--secondary-foreground': { h: 222.2, s: 0.474, l: 0.112 },
+ '--accent': { h: 210, s: 0.3, l: 0.961 },
+ '--accent-foreground': { h: 222.2, s: 0.474, l: 0.112 },
+ '--destructive': { h: 0, s: 1, l: 0.5 },
+ '--destructive-foreground': { h: 210, s: 0.4, l: 0.98 },
+ '--black-button': { h: 0, s: 0, l: 0.07 },
+};
+
+const themeKeys = {
+ "--primary": "主题色",
+ "--primary-foreground": "主题前景色",
+ "--background": "背景色",
+ "--foreground": "前景色",
+ "--muted": "柔和背景色",
+ "--muted-foreground": "柔和前景色",
+ "--card": "卡片背景色",
+ "--card-foreground": "卡片前景色",
+ "--popover": "弹出框背景色",
+ "--popover-foreground": "弹出框前景色",
+ "--border": "边框色",
+ "--input": "输入框边框色",
+ "--secondary": "次要按钮背景色",
+ "--secondary-foreground": "次要按钮前景色",
+ "--accent": "强调色",
+ "--accent-foreground": "强调前景色",
+ "--destructive": "警告按钮背景色",
+ "--destructive-foreground": "警告按钮前景色",
+ "--ring": "聚焦边框色",
+ "--radius": "圆角半径",
+ "--warning": "警告色",
+ "--warning-foreground": "警告前景色",
+ '--black-button': '黑按钮',
+};
+
+export default function Theme() {
+ const [theme, setTheme] = useState(Object.keys(window.ThemeStyle.comp).length ? window.ThemeStyle.comp : { ...defaultTheme });
+
+ const applyTheme = (theme) => {
+ Object.keys(theme).forEach(key => {
+ document.documentElement.style.setProperty(key, handleHSLtoStr(theme[key]));
+ });
+ setTheme(theme);
+ window.ThemeStyle = { comp: theme }
+ saveThemeApi(JSON.stringify({ comp: theme }))
+ };
+
+ // hsl -> '220 98% 95%'
+ const handleHSLtoStr = (hsl) => {
+ return `${hsl.h} ${hsl.s * 100}% ${hsl.l * 100}%`
+ }
+
+ const handleHSLChange = (name, hsl) => {
+ const newTheme = {
+ ...theme,
+ [name]: hsl,
+ };
+ setTheme(newTheme);
+ document.documentElement.style.setProperty(name, handleHSLtoStr(hsl));
+ // save
+ window.ThemeStyle = { comp: newTheme }
+ saveThemeApi(JSON.stringify({ comp: newTheme }))
+ };
+
+
+ return
+
+
+ 颜色配置
+ applyTheme({ ...defaultTheme })}> 还原
+
+
+ {
+ Object.keys(theme).map(key => {
+ return
+ })
+ }
+
+
+
+
组件预览
+
+ {/* 组件列表 */}
+
+
+
+
+};
diff --git a/src/frontend/src/routes.tsx b/src/frontend/src/routes.tsx
index dfec19baf..6dcf0cfc4 100755
--- a/src/frontend/src/routes.tsx
+++ b/src/frontend/src/routes.tsx
@@ -5,6 +5,7 @@ import BuildLayout from "./layout/BuildLayout";
import MainLayout from "./layout/MainLayout";
import SkillChatPage from "./pages/ChatAppPage";
import ChatShare from "./pages/ChatAppPage/chatShare";
+import ChatAssitantShare from "./pages/ChatAppPage/chatAssitantShare";
import ChatPro from "./pages/ChatAppPage/chatWebview";
import DiffFlowPage from "./pages/DiffFlowPage";
import FileLibPage from "./pages/FileLibPage";
@@ -98,6 +99,7 @@ const privateRouter = [
// 独立会话页
{ path: "/chat", element:
},
{ path: "/chat/:id/", element:
},
+ { path: "/chat/assitant/:id/", element:
},
{ path: "/chatpro/:id", element:
},
{ path: "/report/:id/", element:
},
{ path: "/diff/:id/:vid/:cid", element:
},
@@ -139,6 +141,7 @@ export const publicRouter = createBrowserRouter([
{ path: "/", element:
},
{ path: "/reset", element:
},
{ path: "/chat/:id/", element:
},
+ { path: "/chat/assitant/:id/", element:
},
{ path: "*", element:
}
],
baseConfig)
diff --git a/src/frontend/src/store/assistantStore.tsx b/src/frontend/src/store/assistantStore.tsx
index 75129ca87..2ed583cf3 100644
--- a/src/frontend/src/store/assistantStore.tsx
+++ b/src/frontend/src/store/assistantStore.tsx
@@ -13,7 +13,7 @@ type State = {
type Actions = {
dispatchAssistant: (action: Action, assistantState: Partial
) => void,
- loadAssistantState: (id: string) => Promise
+ loadAssistantState: (id: string, version: string) => Promise
saveAfter: () => void
destroy: () => void
}
@@ -56,8 +56,8 @@ export const useAssistantStore = create((set) => ({
assistantState: { ...assistantTemp },
dispatchAssistant: (action: Action, data: Partial) => set((state) => assistantReducer(state, action, data)),
// 加载助手状态
- loadAssistantState: (id) => {
- return getAssistantDetailApi(id).then(data => {
+ loadAssistantState: (id, version) => {
+ return getAssistantDetailApi(id, version).then(data => {
set({
assistantState: {
...data,
diff --git a/src/frontend/src/style/applies.css b/src/frontend/src/style/applies.css
index 97f0265a9..bdfb5eccc 100644
--- a/src/frontend/src/style/applies.css
+++ b/src/frontend/src/style/applies.css
@@ -981,16 +981,12 @@
}
.navlink.active{
- @apply bg-[#fff] text-[#0055e3] shadow-sm
- }
-
- .navlink.active{
- @apply dark:bg-[#34353A] dark:text-[#FFFFFF] dark:shadow-sm
+ @apply bg-[#fff] text-primary shadow-sm dark:bg-[#34353A] dark:text-[#FFFFFF] dark:shadow-sm
}
/* new ui */
.bisheng-label {
- @apply text-sm text-[#67728F] font-medium leading-none
+ @apply text-sm text-muted-foreground font-medium leading-none
}
.bisheng-tip {
diff --git a/src/frontend/src/style/index.css b/src/frontend/src/style/index.css
index 07473d0fd..50803d12a 100644
--- a/src/frontend/src/style/index.css
+++ b/src/frontend/src/style/index.css
@@ -22,10 +22,6 @@
--background-new: hsla(240, 14%, 99%, 1);
- --background-hoverAssistant: hsla(0, 0%, 100%, 1);
-
- --background-Assistant: hsla(0, 0%, 100%, 1);
-
--nav-hover: white;
--header-icon: white;
@@ -71,10 +67,10 @@
--destructive: 0 100% 50%;
/* hsl(0 100% 50%) */
--destructive-foreground: 210 40% 98%;
- /* hsl(210 40% 98%) */
- --radius: .58rem;
- --ring: 223, 48%, 44%, 0.35;
+ --black-button: 0 0% 7%;
/* hsl(215 20% 65%) */
+ --ring: 223, 48%, 44%, 0.35;
+ --radius: .58rem;
--round-btn-shadow: #00000063;
--error-background: #fef2f2;
@@ -124,10 +120,6 @@
--background-new: hsla(0, 0%, 9%, 1);
- --background-hoverAssistant: hsla(240, 1%, 16%, 1);
-
- --background-Assistant: hsla(240, 1%, 13%, 1);
-
--nav-hover: rgba(52, 53, 58, 1);
--header-icon: rgba(33, 33, 34, 1);
@@ -157,7 +149,7 @@
--popover-foreground: 215 20.2% 65.1%;
/* hsl(215 20% 65%) */
- --card: 224 25% 15.5%;
+ --card: 240 1% 13%;
/* hsl(224 71% 4%) */
--card-foreground: 213 31% 80%;
/* hsl(213 31% 91%) */
@@ -186,6 +178,7 @@
/* hsl(0 63% 31%) */
--destructive-foreground: 210 40% 98%;
/* hsl(210 40% 98%) */
+ --black-button: 0 0% 7%;
--ring: 216 24% 30%;
/* hsl(216 24% 30%) */
diff --git a/src/frontend/tailwind.config.js b/src/frontend/tailwind.config.js
index 85ee3273d..b6445d011 100644
--- a/src/frontend/tailwind.config.js
+++ b/src/frontend/tailwind.config.js
@@ -30,8 +30,6 @@ module.exports = {
extend: {
colors: {
"search-input": "var(--search-input)",
- "background-Assistant": "var(--background-Assistant)",
- "background-hoverAssistant": "var(--background-hoverAssistant)",
"background-new": "var(--background-new)",
"prompt-description": "var(--text-prompt)",
"background-prompt": "var(--background-prompt)",
@@ -95,7 +93,7 @@ module.exports = {
"beta-foreground": "var(--beta-foreground)",
"chat-bot-icon": "var(--chat-bot-icon)",
"chat-user-icon": "var(--chat-user-icon)",
-
+ "black-button": "hsl(var(--black-button))",
white: "var(--white)",
border: "hsl(var(--border))",
input: "hsl(var(--input)/0.15)",