From f6d5733183c31b2592ca4d5c489191ce5d2282f7 Mon Sep 17 00:00:00 2001 From: jialin Date: Tue, 10 Mar 2026 11:22:11 +0800 Subject: [PATCH] fix: video gen --- src/pages/playground/config/index.ts | 19 +++++++++++++ .../playground/hooks/use-init-video-meta.ts | 6 ----- src/pages/playground/hooks/use-text-video.ts | 3 +-- src/pages/playground/video/index.tsx | 2 +- src/pages/playground/video/page.tsx | 27 ++++++++++++++----- src/utils/index.ts | 2 +- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/src/pages/playground/config/index.ts b/src/pages/playground/config/index.ts index 5314cdb0..e72f90ee 100644 --- a/src/pages/playground/config/index.ts +++ b/src/pages/playground/config/index.ts @@ -191,3 +191,22 @@ export const defaultLanguages = [ { label: 'Français', value: 'fr' }, { label: 'Deutsch', value: 'de' } ]; + +export const videoPromptList = [ + 'A golden retriever running on the beach at sunset, cinematic lighting.', + 'A futuristic city at night with neon lights and flying cars, cyberpunk style.', + 'A peaceful mountain lake at sunrise, mist on the water, cinematic drone shot.', + 'A cute orange cat sitting on a desk typing on a laptop, cozy room lighting.', + 'Rain falling on a Tokyo street at night, neon reflections on wet road.', + 'A rocket launching into space, dramatic lighting, slow motion.', + 'A field of sunflowers blowing in the wind under blue sky, natural lighting.', + 'A cup of coffee on a wooden table with steam rising, warm morning light.', + 'A lone astronaut walking across a vast desert at sunset, wind blowing sand, cinematic wide shot, volumetric lighting, ultra realistic.', + 'A futuristic cyberpunk city at night, neon lights reflecting on wet streets, flying cars passing by, camera slowly dollying forward, cinematic lighting, ultra detailed.', + 'A luxury perfume bottle on a marble table, golden sunlight shining through a window, water droplets floating in the air, macro lens, high-end commercial style.', + 'A medieval knight standing on a mountain cliff during a storm, cape blowing in the wind, lightning in the background, epic cinematic lighting.', + 'A peaceful forest in early morning, sunlight streaming through the trees, fog drifting slowly, cinematic nature documentary style, ultra realistic.', + 'A young woman walking through a rainy Tokyo street at night, neon signs glowing, reflections on wet pavement, tracking shot, cinematic atmosphere.', + 'A dragon flying above snowy mountains, clouds swirling below, epic fantasy cinematic shot, dramatic lighting, ultra detailed.', + 'A spaceship landing on an alien planet, glowing plants and mist surrounding the area, cinematic wide shot, science fiction movie style.' +]; diff --git a/src/pages/playground/hooks/use-init-video-meta.ts b/src/pages/playground/hooks/use-init-video-meta.ts index ee810d4e..11bf16c9 100644 --- a/src/pages/playground/hooks/use-init-video-meta.ts +++ b/src/pages/playground/hooks/use-init-video-meta.ts @@ -220,11 +220,6 @@ export const useInitVideoMeta = ( }); }; - const formFields = useMemo(() => { - const fields = paramsConfig?.map((item) => item.name); - return fields?.join(','); - }, [paramsConfig]); - const handleOnModelChange = useMemoizedFn((val: string) => { if (!val) return; const model = modelList.find((item) => item.value === val); @@ -328,7 +323,6 @@ export const useInitVideoMeta = ( setParamsConfig, form, modelMeta, - formFields, paramsConfig, initialValues, parameters, diff --git a/src/pages/playground/hooks/use-text-video.ts b/src/pages/playground/hooks/use-text-video.ts index ed2dbdb5..f89dffea 100644 --- a/src/pages/playground/hooks/use-text-video.ts +++ b/src/pages/playground/hooks/use-text-video.ts @@ -1,6 +1,6 @@ import { createAxiosToken } from '@/hooks/use-chunk-request'; import useOverlayScroller from '@/hooks/use-overlay-scroller'; -import { extractErrorMessage, promptList } from '@/pages/playground/config'; +import { extractErrorMessage } from '@/pages/playground/config'; import { useIntl } from '@umijs/max'; import _ from 'lodash'; import { useEffect, useRef, useState } from 'react'; @@ -142,7 +142,6 @@ export default function useTextVideo(props: any) { loading, tokenResult, videoList, - promptList, currentPrompt, setVideoList, setTokenResult, diff --git a/src/pages/playground/video/index.tsx b/src/pages/playground/video/index.tsx index b5074acb..4f1a0d68 100644 --- a/src/pages/playground/video/index.tsx +++ b/src/pages/playground/video/index.tsx @@ -40,7 +40,7 @@ const PlaygroundRerank: React.FC = () => { const getModelList = async () => { try { const params = { - categories: modelCategoriesMap.llm, + categories: modelCategoriesMap.image, with_meta: true }; const res = await queryModelsList(params); diff --git a/src/pages/playground/video/page.tsx b/src/pages/playground/video/page.tsx index 87b5c3f3..0bddc63e 100644 --- a/src/pages/playground/video/page.tsx +++ b/src/pages/playground/video/page.tsx @@ -1,9 +1,10 @@ import { setRouteCache } from '@/atoms/route-cache'; import AlertInfo from '@/components/alert-info'; +import IconFont from '@/components/icon-font'; import routeCachekey from '@/config/route-cachekey'; import { VideoCameraOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; -import { Spin } from 'antd'; +import { Button, Spin, Tooltip } from 'antd'; import _ from 'lodash'; import 'overlayscrollbars/overlayscrollbars.css'; import React, { @@ -18,6 +19,7 @@ import { CREATE_VIDEO_API } from '../apis'; import MessageInput from '../components/message-input'; import RightContainer from '../components/right-container'; import ViewCommonCode from '../components/view-common-code'; +import { videoPromptList } from '../config'; import { useInitVideoMeta } from '../hooks/use-init-video-meta'; import useTextVideo from '../hooks/use-text-video'; import '../style/ground-llm.less'; @@ -38,7 +40,6 @@ const GroundVideo: React.FC = forwardRef((props, ref) => { const [show, setShow] = useState(false); const [collapse, setCollapse] = useState(false); const scroller = useRef(null); - const paramsRef = useRef(null); const inputRef = useRef(null); const { @@ -46,7 +47,6 @@ const GroundVideo: React.FC = forwardRef((props, ref) => { handleToggleParamsStyle, setParams, form, - formFields, paramsConfig, initialValues, parameters, @@ -58,7 +58,6 @@ const GroundVideo: React.FC = forwardRef((props, ref) => { loading, tokenResult, videoList, - promptList, currentPrompt, setCurrentPrompt, handleClear, @@ -86,8 +85,8 @@ const GroundVideo: React.FC = forwardRef((props, ref) => { }; const handleRandomPrompt = useCallback(() => { - const randomIndex = generateNumber(0, promptList.length - 1); - const randomPrompt = promptList[randomIndex]; + const randomIndex = generateNumber(0, videoPromptList.length - 1); + const randomPrompt = videoPromptList[randomIndex]; inputRef.current?.handleInputChange({ target: { value: randomPrompt @@ -237,6 +236,22 @@ const GroundVideo: React.FC = forwardRef((props, ref) => { onInputChange={handleInputChange} shouldResetMessage={false} clearAll={handleClear} + tools={ + <> + + + + + } /> diff --git a/src/utils/index.ts b/src/utils/index.ts index b938a2d5..a254064f 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -344,7 +344,7 @@ export const parseParamsString = (paramsString: string): string[] => { } else if (token.startsWith('-')) { // Check if next token is a value (does not start with '-') const nextToken = tokens[i + 1]; - if (nextToken && !nextToken.startsWith('-')) { + if (nextToken && !nextToken.startsWith('-') && !nextToken.includes('=')) { // If value is quoted, keep space format if (nextToken.startsWith('"') || nextToken.startsWith("'")) { result.push(`${token} ${nextToken}`);