From 314cb036939cdc24bd07104d62111aaf73b4091e Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Mon, 25 Nov 2024 21:17:16 +0700 Subject: [PATCH] feat: stop word model setting (#4113) * feat: stop word model setting * chore: update test tag input * chore: handle UI when no stop word * chore: fix types of value tag input --- core/src/types/setting/settingComponent.ts | 4 +- web/containers/EngineSetting/index.tsx | 5 +- web/containers/ModelConfigInput/index.tsx | 44 +++++----- .../ModelSetting/SettingComponent.tsx | 25 +++++- web/containers/ModelSetting/index.tsx | 5 +- web/containers/TagInput/index.test.tsx | 50 +++++++++++ web/containers/TagInput/index.tsx | 85 +++++++++++++++++++ .../LocalServerRightPanel/index.tsx | 2 +- .../Settings/ExtensionSetting/index.tsx | 2 +- .../SettingDetailTextInputItem/index.tsx | 2 +- .../SettingDetail/SettingDetailItem/index.tsx | 5 +- .../AssistantSetting/index.tsx | 2 +- .../PromptTemplateSetting/index.tsx | 2 +- web/screens/Thread/ThreadRightPanel/index.tsx | 2 +- web/utils/componentSettings.ts | 5 +- web/utils/predefinedComponent.ts | 6 +- 16 files changed, 208 insertions(+), 38 deletions(-) create mode 100644 web/containers/TagInput/index.test.tsx create mode 100644 web/containers/TagInput/index.tsx diff --git a/core/src/types/setting/settingComponent.ts b/core/src/types/setting/settingComponent.ts index 2eae4e16f..2474f6bd4 100644 --- a/core/src/types/setting/settingComponent.ts +++ b/core/src/types/setting/settingComponent.ts @@ -12,7 +12,7 @@ export type SettingComponentProps = { export type ConfigType = 'runtime' | 'setting' -export type ControllerType = 'slider' | 'checkbox' | 'input' +export type ControllerType = 'slider' | 'checkbox' | 'input' | 'tag' export type InputType = 'password' | 'text' | 'email' | 'number' | 'tel' | 'url' @@ -22,7 +22,7 @@ export type InputAction = InputActionsTuple[number] export type InputComponentProps = { placeholder: string - value: string + value: string | string[] type?: InputType textAlign?: 'left' | 'right' inputActions?: InputAction[] diff --git a/web/containers/EngineSetting/index.tsx b/web/containers/EngineSetting/index.tsx index acbd507ce..0ae2929bf 100644 --- a/web/containers/EngineSetting/index.tsx +++ b/web/containers/EngineSetting/index.tsx @@ -4,7 +4,10 @@ import SettingComponentBuilder from '@/containers/ModelSetting/SettingComponent' type Props = { componentData: SettingComponentProps[] - onValueChanged: (key: string, value: string | number | boolean) => void + onValueChanged: ( + key: string, + value: string | number | boolean | string[] + ) => void disabled?: boolean } diff --git a/web/containers/ModelConfigInput/index.tsx b/web/containers/ModelConfigInput/index.tsx index f0e6ea1f2..e67080df2 100644 --- a/web/containers/ModelConfigInput/index.tsx +++ b/web/containers/ModelConfigInput/index.tsx @@ -19,28 +19,30 @@ const ModelConfigInput = ({ description, placeholder, onValueChanged, -}: Props) => ( -
-
-

{title}

- - } - content={description} +}: Props) => { + return ( +
+
+

{title}

+ + } + content={description} + /> +
+