balibabu
commited on
Commit
·
349437c
1
Parent(s):
2f498b0
fix: Fixed the issue that the related form value does not change after selecting the freedom field of the model #1804 (#1805)
Browse files### What problem does this PR solve?
fix: Fixed the issue that the related form value does not change after
selecting the freedom field of the model #1804
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
web/src/components/llm-select/index.tsx
CHANGED
@@ -17,7 +17,13 @@ const LLMSelect = ({ id, value, onChange }: IProps) => {
|
|
17 |
);
|
18 |
|
19 |
return (
|
20 |
-
<Popover
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
<Select
|
22 |
style={{ width: '100%' }}
|
23 |
dropdownStyle={{ display: 'none' }}
|
|
|
17 |
);
|
18 |
|
19 |
return (
|
20 |
+
<Popover
|
21 |
+
content={content}
|
22 |
+
trigger="click"
|
23 |
+
placement="left"
|
24 |
+
arrow={false}
|
25 |
+
destroyTooltipOnHide
|
26 |
+
>
|
27 |
<Select
|
28 |
style={{ width: '100%' }}
|
29 |
dropdownStyle={{ display: 'none' }}
|
web/src/components/llm-setting-items/index.tsx
CHANGED
@@ -28,9 +28,13 @@ const LlmSettingItems = ({ prefix, formItemLayout = {} }: IProps) => {
|
|
28 |
const handleParametersChange = useCallback(
|
29 |
(value: ModelVariableType) => {
|
30 |
const variable = settledModelVariableMap[value];
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
},
|
33 |
-
[form],
|
34 |
);
|
35 |
|
36 |
const memorizedPrefix = useMemo(() => (prefix ? [prefix] : []), [prefix]);
|
@@ -46,7 +50,13 @@ const LlmSettingItems = ({ prefix, formItemLayout = {} }: IProps) => {
|
|
46 |
{...formItemLayout}
|
47 |
rules={[{ required: true, message: t('modelMessage') }]}
|
48 |
>
|
49 |
-
<Select
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
</Form.Item>
|
51 |
<Divider></Divider>
|
52 |
<Form.Item
|
|
|
28 |
const handleParametersChange = useCallback(
|
29 |
(value: ModelVariableType) => {
|
30 |
const variable = settledModelVariableMap[value];
|
31 |
+
let nextVariable: Record<string, any> = variable;
|
32 |
+
if (prefix) {
|
33 |
+
nextVariable = { [prefix]: variable };
|
34 |
+
}
|
35 |
+
form.setFieldsValue(nextVariable);
|
36 |
},
|
37 |
+
[form, prefix],
|
38 |
);
|
39 |
|
40 |
const memorizedPrefix = useMemo(() => (prefix ? [prefix] : []), [prefix]);
|
|
|
50 |
{...formItemLayout}
|
51 |
rules={[{ required: true, message: t('modelMessage') }]}
|
52 |
>
|
53 |
+
<Select
|
54 |
+
options={[
|
55 |
+
...modelOptions[LlmModelType.Chat],
|
56 |
+
...modelOptions[LlmModelType.Image2text],
|
57 |
+
]}
|
58 |
+
showSearch
|
59 |
+
/>
|
60 |
</Form.Item>
|
61 |
<Divider></Divider>
|
62 |
<Form.Item
|
web/src/pages/add-knowledge/components/knowledge-file/model.ts
CHANGED
@@ -101,7 +101,7 @@ const model: DvaModel<KFModelState> = {
|
|
101 |
function* ({ payload }, { call, put }) {
|
102 |
yield put({ type: 'getKfList', payload: { kb_id: payload } });
|
103 |
},
|
104 |
-
{ type: 'poll', delay:
|
105 |
],
|
106 |
*updateDocumentStatus({ payload = {} }, { call, put }) {
|
107 |
const { data } = yield call(
|
|
|
101 |
function* ({ payload }, { call, put }) {
|
102 |
yield put({ type: 'getKfList', payload: { kb_id: payload } });
|
103 |
},
|
104 |
+
{ type: 'poll', delay: 15000 }, // TODO: Provide type support for this effect
|
105 |
],
|
106 |
*updateDocumentStatus({ payload = {} }, { call, put }) {
|
107 |
const { data } = yield call(
|
web/src/pages/flow/hooks.ts
CHANGED
@@ -252,8 +252,22 @@ export const useHandleFormValuesChange = (id?: string) => {
|
|
252 |
const updateNodeForm = useGraphStore((state) => state.updateNodeForm);
|
253 |
const handleValuesChange = useCallback(
|
254 |
(changedValues: any, values: any) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
if (id) {
|
256 |
-
updateNodeForm(id,
|
257 |
}
|
258 |
},
|
259 |
[updateNodeForm, id],
|
|
|
252 |
const updateNodeForm = useGraphStore((state) => state.updateNodeForm);
|
253 |
const handleValuesChange = useCallback(
|
254 |
(changedValues: any, values: any) => {
|
255 |
+
let nextValues: any = values;
|
256 |
+
// Fixed the issue that the related form value does not change after selecting the freedom field of the model
|
257 |
+
if (
|
258 |
+
Object.keys(changedValues).length === 1 &&
|
259 |
+
'parameter' in changedValues &&
|
260 |
+
changedValues['parameter'] in settledModelVariableMap
|
261 |
+
) {
|
262 |
+
nextValues = {
|
263 |
+
...values,
|
264 |
+
...settledModelVariableMap[
|
265 |
+
changedValues['parameter'] as keyof typeof settledModelVariableMap
|
266 |
+
],
|
267 |
+
};
|
268 |
+
}
|
269 |
if (id) {
|
270 |
+
updateNodeForm(id, nextValues);
|
271 |
}
|
272 |
},
|
273 |
[updateNodeForm, id],
|