fix: video gen

This commit is contained in:
jialin
2026-03-17 16:35:55 +08:00
committed by jialin
parent 0ca055b8e8
commit f6d5733183
6 changed files with 43 additions and 16 deletions
+19
View File
@@ -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.'
];
@@ -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,
+1 -2
View File
@@ -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,
+1 -1
View File
@@ -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);
+21 -6
View File
@@ -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<MessageProps> = forwardRef((props, ref) => {
const [show, setShow] = useState(false);
const [collapse, setCollapse] = useState(false);
const scroller = useRef<any>(null);
const paramsRef = useRef<any>(null);
const inputRef = useRef<any>(null);
const {
@@ -46,7 +47,6 @@ const GroundVideo: React.FC<MessageProps> = forwardRef((props, ref) => {
handleToggleParamsStyle,
setParams,
form,
formFields,
paramsConfig,
initialValues,
parameters,
@@ -58,7 +58,6 @@ const GroundVideo: React.FC<MessageProps> = forwardRef((props, ref) => {
loading,
tokenResult,
videoList,
promptList,
currentPrompt,
setCurrentPrompt,
handleClear,
@@ -86,8 +85,8 @@ const GroundVideo: React.FC<MessageProps> = 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<MessageProps> = forwardRef((props, ref) => {
onInputChange={handleInputChange}
shouldResetMessage={false}
clearAll={handleClear}
tools={
<>
<Tooltip
title={intl.formatMessage({
id: 'playground.image.prompt.random'
})}
>
<Button
onClick={handleRandomPrompt}
size="middle"
type="text"
icon={<IconFont type="icon-random"></IconFont>}
></Button>
</Tooltip>
</>
}
/>
</div>
</div>
+1 -1
View File
@@ -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}`);