diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index e77f5ab0..09d9e83b 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -359,18 +359,18 @@ export default (props: any) => { }; useEffect(() => { - // 先清除旧的性能标记 + // clear previous marks and measures performance.clearMarks(); performance.clearMeasures(); - // 记录开始时间 + // record start time performance.mark('route-start'); requestAnimationFrame(() => { - // 记录结束时间 + // record end time performance.mark('route-end'); - // 确保 `route-start` 存在后再测量 + // make sure `route-start` exists if (performance.getEntriesByName('route-start').length > 0) { performance.measure('route-change', 'route-start', 'route-end'); @@ -379,7 +379,7 @@ export default (props: any) => { `[Performance] Route change to ${location.pathname} took ${measure.duration.toFixed(2)}ms` ); - // 清理标记 + // clear marks and measures performance.clearMarks(); performance.clearMeasures(); } else { diff --git a/src/pages/llmodels/config/llama-config.ts b/src/pages/llmodels/config/llama-config.ts index 3359e61b..2a2aa988 100644 --- a/src/pages/llmodels/config/llama-config.ts +++ b/src/pages/llmodels/config/llama-config.ts @@ -588,6 +588,10 @@ const options = [ { label: '--jinja', value: '--jinja' + }, + { + label: '--context-shift', + value: '--context-shift' } ]; diff --git a/src/pages/playground/components/dynamic-params.tsx b/src/pages/playground/components/dynamic-params.tsx index efb1f173..066db501 100644 --- a/src/pages/playground/components/dynamic-params.tsx +++ b/src/pages/playground/components/dynamic-params.tsx @@ -24,7 +24,8 @@ type ParamsSettingsProps = { paramsConfig?: ParamsSchema[]; initialValues?: Record; // for initial values when switch model, aviod update values from setParams extra?: React.ReactNode; - watchFields?: any[]; + watchFields?: string[]; + formFields?: string; }; const ParamsSettings: React.FC = forwardRef( @@ -36,7 +37,8 @@ const ParamsSettings: React.FC = forwardRef( initialValues, paramsConfig, modelList, - watchFields = [], + watchFields, + formFields, showModelSelector = true, extra }, @@ -86,7 +88,7 @@ const ParamsSettings: React.FC = forwardRef( ); const renderFields = useMemo(() => { - if (!paramsConfig) { + if (!paramsConfig?.length) { return null; } console.log('renderFields---------'); @@ -123,7 +125,7 @@ const ParamsSettings: React.FC = forwardRef( ); }); - }, [paramsConfig, intl, watchFields]); + }, [formFields, intl, watchFields]); return (
= forwardRef((props, ref) => { handleOnValuesChange(changeValues, allValues); } }, - [handleOnValuesChange] + [] ); useHotkeys( diff --git a/src/pages/playground/components/ground-images.tsx b/src/pages/playground/components/ground-images.tsx index cd65a041..5b7dda03 100644 --- a/src/pages/playground/components/ground-images.tsx +++ b/src/pages/playground/components/ground-images.tsx @@ -50,6 +50,7 @@ const GroundImages: React.FC = forwardRef((props, ref) => { setParams, form, watchFields, + formFields, paramsConfig, initialValues, parameters, @@ -298,6 +299,7 @@ const GroundImages: React.FC = forwardRef((props, ref) => { diff --git a/src/pages/playground/components/ground-reranker.tsx b/src/pages/playground/components/ground-reranker.tsx index df4ffd55..519b72cf 100644 --- a/src/pages/playground/components/ground-reranker.tsx +++ b/src/pages/playground/components/ground-reranker.tsx @@ -431,16 +431,13 @@ const GroundReranker: React.FC = forwardRef((props, ref) => { setIsEmptyText(false); }; - const onValuesChange = useCallback( - (changedValues: any, allValues: any) => { - if (changedValues.model) { - setTokenResult(null); - } else { - handleOnValuesChange(changedValues, allValues); - } - }, - [handleOnValuesChange] - ); + const onValuesChange = useCallback((changedValues: any, allValues: any) => { + if (changedValues.model) { + setTokenResult(null); + } else { + handleOnValuesChange(changedValues, allValues); + } + }, []); useHotkeys( HotKeys.SUBMIT, diff --git a/src/pages/playground/components/image-edit.tsx b/src/pages/playground/components/image-edit.tsx index 2eceaf9b..e0e4391b 100644 --- a/src/pages/playground/components/image-edit.tsx +++ b/src/pages/playground/components/image-edit.tsx @@ -75,6 +75,7 @@ const GroundImages: React.FC = forwardRef((props, ref) => { setParamsConfig, form, watchFields, + formFields, paramsConfig, initialValues, parameters, @@ -527,6 +528,7 @@ const GroundImages: React.FC = forwardRef((props, ref) => { diff --git a/src/pages/playground/hooks/use-init-meta.ts b/src/pages/playground/hooks/use-init-meta.ts index 48037e8d..6a952512 100644 --- a/src/pages/playground/hooks/use-init-meta.ts +++ b/src/pages/playground/hooks/use-init-meta.ts @@ -366,6 +366,11 @@ export const useInitImageMeta = (props: MessageProps) => { }); }; + const formFields = useMemo(() => { + const fields = paramsConfig?.map((item) => item.name); + return fields?.join(','); + }, [paramsConfig]); + const handleOnModelChange = useCallback( (val: string) => { if (!val || val === parameters.model) return; @@ -461,6 +466,7 @@ export const useInitImageMeta = (props: MessageProps) => { updateParamsConfig, setParamsConfig, form, + formFields, watchFields, paramsConfig, initialValues,