From 323953462b30caf38072abdc095221ce089648ea Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Sat, 22 Jul 2023 22:18:16 +0800 Subject: [PATCH] perf: phone ui --- client/src/constants/theme.ts | 4 ++- .../app/detail/components/BasicEdit/index.tsx | 35 ++++++++++--------- .../app/detail/components/KBSelectModal.tsx | 28 +++++++++------ .../pages/app/detail/components/OverView.tsx | 6 ++-- 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/client/src/constants/theme.ts b/client/src/constants/theme.ts index 97ed528c4..397a5bce6 100644 --- a/client/src/constants/theme.ts +++ b/client/src/constants/theme.ts @@ -17,7 +17,9 @@ const { definePartsStyle: numInputPart, defineMultiStyleConfig: numInputMultiSty // modal 弹窗 const ModalTheme = defineMultiStyleConfig({ baseStyle: definePartsStyle({ - dialog: {} + dialog: { + maxW: '90vw' + } }) }); diff --git a/client/src/pages/app/detail/components/BasicEdit/index.tsx b/client/src/pages/app/detail/components/BasicEdit/index.tsx index ffd4ed3d5..91ea004f6 100644 --- a/client/src/pages/app/detail/components/BasicEdit/index.tsx +++ b/client/src/pages/app/detail/components/BasicEdit/index.tsx @@ -21,6 +21,7 @@ import { useUserStore } from '@/store/user'; import { useQuery } from '@tanstack/react-query'; import { QuestionOutlineIcon, SmallAddIcon } from '@chakra-ui/icons'; import { useForm, useFieldArray } from 'react-hook-form'; +import { useGlobalStore } from '@/store/global'; import { appModules2Form, getDefaultAppForm, @@ -59,6 +60,7 @@ const VariableEditModal = dynamic(() => import('../VariableEditModal')); const Settings = ({ appId }: { appId: string }) => { const theme = useTheme(); const { appDetail, updateAppDetail, loadKbList, myKbList } = useUserStore(); + const { isPc } = useGlobalStore(); const [editVariable, setEditVariable] = useState(); @@ -153,9 +155,15 @@ const Settings = ({ appId }: { appId: string }) => { bg: 'myGray.200' } }; + const LabelStyles: BoxProps = { + w: ['60px', '100px'], + flexShrink: 0, + fontSize: ['sm', 'md'] + }; return ( - { pt={4} pl={4} > - + 应用配置 @@ -175,7 +183,7 @@ const Settings = ({ appId }: { appId: string }) => { fontSize={'sm'} onClick={openConfirm(handleSubmit((data) => onSubmitSave(data)))} > - 保存并预览 + {isPc ? '保存并预览' : '保存'} @@ -243,9 +251,7 @@ const Settings = ({ appId }: { appId: string }) => { - - 对话模型 - + 对话模型 { /> - - 温度 - + 温度 { - - 回复上限 - + 回复上限 { - + 提示词 @@ -319,7 +321,7 @@ const Settings = ({ appId }: { appId: string }) => { > - + 限定词 @@ -434,7 +436,7 @@ const Settings = ({ appId }: { appId: string }) => { }} /> )} - + ); }; @@ -517,10 +519,11 @@ const ChatTest = ({ appId }: { appId: string }) => { }; const BasicEdit = ({ appId }: { appId: string }) => { + const { isPc } = useGlobalStore(); return ( - + {isPc && } ); }; diff --git a/client/src/pages/app/detail/components/KBSelectModal.tsx b/client/src/pages/app/detail/components/KBSelectModal.tsx index 022043b0d..f414216e4 100644 --- a/client/src/pages/app/detail/components/KBSelectModal.tsx +++ b/client/src/pages/app/detail/components/KBSelectModal.tsx @@ -17,10 +17,11 @@ import { import Avatar from '@/components/Avatar'; import { KbListItemType } from '@/types/plugin'; import { useForm } from 'react-hook-form'; -import MyTooltip from '@/components/MyTooltip'; import { QuestionOutlineIcon } from '@chakra-ui/icons'; import type { SelectedKbType } from '@/types/plugin'; +import { useGlobalStore } from '@/store/global'; import MySlider from '@/components/Slider'; +import MyTooltip from '@/components/MyTooltip'; export type KbParamsType = { searchSimilarity: number; @@ -41,9 +42,10 @@ export const KBSelectModal = ({ }) => { const theme = useTheme(); const [selectedKbList, setSelectedKbList] = useState(activeKbs); + const { isPc } = useGlobalStore(); return ( - + 搜索参数调整 - - + + 相似度 @@ -162,9 +164,11 @@ export const KbParamsModal = ({ setRefresh(!refresh); }} /> - - - 单次搜索数量 + + + + 单次搜索数量 + - - - 空搜索回复 + + + + 空搜索回复 + - +