From 4a9a898bca8c46294a41ce95684e039e0e661238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AF=BB=E6=89=BE=E4=B8=80=E6=9D=9F=E5=85=89?= <6@6-2.vip> Date: Wed, 20 Nov 2024 22:16:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor(components):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=88=97=E8=A1=A8=E5=92=8C=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA=E6=A8=A1=E5=9E=8B=E5=88=87=E6=8D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加模型列表和模型项的样式,提高用户体验 - 实现模型项的选中状态样式,便于用户识别当前选择 - 更新机器人模型切换逻辑,使用 updateTargetSession 方法 --- app/components/chat.module.scss | 30 ++++++++++++++++++++++++++++++ app/components/chat.tsx | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/components/chat.module.scss b/app/components/chat.module.scss index 7560d030533..bea74a835db 100644 --- a/app/components/chat.module.scss +++ b/app/components/chat.module.scss @@ -751,3 +751,33 @@ } } } + +.model-list { + display: flex; + flex-wrap: wrap; +} + +.model-item { + margin: 10px; + padding: 10px; + border: 1px solid #ccc; + cursor: pointer; + border-radius: 5px; +} + +.model-item.selected { + background-color: #007bff; + color: white; +} + +.radio-button-robot { + height: 55px; + width: 100%; + font-size: 17px; + line-height: 55px; + text-align: center; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-weight: bold; +} diff --git a/app/components/chat.tsx b/app/components/chat.tsx index a5a3b7afe7c..dff41553a72 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -833,7 +833,7 @@ export function ChatActions(props: { onClick={() => { //执行切换模型 const [model, providerName] = robotModel.split("@"); - chatStore.updateCurrentSession((session) => { + chatStore.updateTargetSession(session,(session) => { session.mask.modelConfig.model = model as ModelType; session.mask.modelConfig.providerName = providerName as ServiceProvider;