perf: variable label picker scroll & focus disappear (#2135)

* fix: variable label picker scroll & focus disappear

* fix

* fix filter

* revert
This commit is contained in:
heheer
2024-07-23 18:03:53 +08:00
committed by GitHub
parent f37cdabb15
commit bf5145e632
10 changed files with 39 additions and 17 deletions

View File

@@ -35,6 +35,7 @@ type useChatStoreType = OutLinkChatAuthProps &
ChatProviderProps & {
welcomeText: string;
variableList: VariableItemType[];
allVariableList: VariableItemType[];
questionGuide: boolean;
ttsConfig: AppTTSConfigType;
whisperConfig: AppWhisperConfigType;
@@ -189,6 +190,7 @@ const Provider = ({
teamToken,
welcomeText,
variableList: variables.filter((item) => item.type !== VariableInputEnum.custom),
allVariableList: variables,
questionGuide,
ttsConfig,
whisperConfig,

View File

@@ -21,7 +21,7 @@ const VariableInput = ({
const { t } = useTranslation();
const { appAvatar, variableList, variablesForm } = useContextSelector(ChatBoxContext, (v) => v);
const { register, getValues, setValue, handleSubmit: handleSubmitChat, control } = variablesForm;
const { register, setValue, handleSubmit: handleSubmitChat, control } = variablesForm;
return (
<Box py={3}>

View File

@@ -140,6 +140,7 @@ const ChatBox = (
const {
welcomeText,
variableList,
allVariableList,
questionGuide,
startSegmentedAudio,
finishSegmentedAudio,
@@ -390,7 +391,7 @@ const ChatBox = (
// delete invalid variables 只保留在 variableList 中的变量
const requestVariables: Record<string, any> = {};
variableList?.forEach((item) => {
allVariableList?.forEach((item) => {
requestVariables[item.key] = variables[item.key] || '';
});