fix: playground formref is invalid

This commit is contained in:
jialin
2025-11-12 14:57:39 +08:00
parent 11a676be83
commit cbc000d35a
17 changed files with 110 additions and 449 deletions
@@ -52,13 +52,13 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
handleAddNewMessage,
handleClear,
setMessageList,
formRef,
tokenResult,
messageList,
loading
} = useChatCompletion(scroller);
const {
handleOnValuesChange,
formRef,
paramsRef,
paramsConfig,
initialValues,
@@ -23,7 +23,6 @@ export default function useChatCompletion(
const currentMessageRef = useRef<any>(null);
const messageListLengthCache = useRef<number>(0);
const reasonContentRef = useRef('');
const formRef = useRef<any>(null);
const setMessageId = () => {
messageId.current = messageId.current + 1;
@@ -217,7 +216,6 @@ export default function useChatCompletion(
loading,
tokenResult,
messageList,
formRef,
setMessageId,
setMessageList,
handleClear,
@@ -52,6 +52,7 @@ export const useInitLLmMeta = (
defaultValues = {},
defaultParamsConfig = []
} = options;
const formRef = useRef<any>(null);
const [searchParams] = useSearchParams();
const [modelMeta, setModelMeta] = useState<any>({});
const [initialValues, setInitialValues] = useState<any>({
@@ -194,6 +195,7 @@ export const useInitLLmMeta = (
setInitialValues,
setParams,
setParamsConfig,
formRef,
paramsConfig,
initialValues,
parameters,
-9
View File
@@ -11,7 +11,6 @@ import classNames from 'classnames';
import _ from 'lodash';
import { useEffect, useMemo, useRef, useState } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import styled from 'styled-components';
import { PageContainerInner } from '../_components/page-box';
import { queryModelsList } from './apis';
import GroundLeft from './components/ground-left';
@@ -19,14 +18,6 @@ import MultipleChat from './components/multiple-chat';
import ViewCodeButtons from './components/view-code-buttons';
import './style/play-ground.less';
const Header = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 16px;
padding-inline: 32px;
`;
const Playground: React.FC = () => {
const intl = useIntl();
const { size } = useWindowResize();