fix: video gen
This commit is contained in:
@@ -191,3 +191,22 @@ export const defaultLanguages = [
|
|||||||
{ label: 'Français', value: 'fr' },
|
{ label: 'Français', value: 'fr' },
|
||||||
{ label: 'Deutsch', value: 'de' }
|
{ 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) => {
|
const handleOnModelChange = useMemoizedFn((val: string) => {
|
||||||
if (!val) return;
|
if (!val) return;
|
||||||
const model = modelList.find((item) => item.value === val);
|
const model = modelList.find((item) => item.value === val);
|
||||||
@@ -328,7 +323,6 @@ export const useInitVideoMeta = (
|
|||||||
setParamsConfig,
|
setParamsConfig,
|
||||||
form,
|
form,
|
||||||
modelMeta,
|
modelMeta,
|
||||||
formFields,
|
|
||||||
paramsConfig,
|
paramsConfig,
|
||||||
initialValues,
|
initialValues,
|
||||||
parameters,
|
parameters,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { createAxiosToken } from '@/hooks/use-chunk-request';
|
import { createAxiosToken } from '@/hooks/use-chunk-request';
|
||||||
import useOverlayScroller from '@/hooks/use-overlay-scroller';
|
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 { useIntl } from '@umijs/max';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
@@ -142,7 +142,6 @@ export default function useTextVideo(props: any) {
|
|||||||
loading,
|
loading,
|
||||||
tokenResult,
|
tokenResult,
|
||||||
videoList,
|
videoList,
|
||||||
promptList,
|
|
||||||
currentPrompt,
|
currentPrompt,
|
||||||
setVideoList,
|
setVideoList,
|
||||||
setTokenResult,
|
setTokenResult,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const PlaygroundRerank: React.FC = () => {
|
|||||||
const getModelList = async () => {
|
const getModelList = async () => {
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
categories: modelCategoriesMap.llm,
|
categories: modelCategoriesMap.image,
|
||||||
with_meta: true
|
with_meta: true
|
||||||
};
|
};
|
||||||
const res = await queryModelsList(params);
|
const res = await queryModelsList(params);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { setRouteCache } from '@/atoms/route-cache';
|
import { setRouteCache } from '@/atoms/route-cache';
|
||||||
import AlertInfo from '@/components/alert-info';
|
import AlertInfo from '@/components/alert-info';
|
||||||
|
import IconFont from '@/components/icon-font';
|
||||||
import routeCachekey from '@/config/route-cachekey';
|
import routeCachekey from '@/config/route-cachekey';
|
||||||
import { VideoCameraOutlined } from '@ant-design/icons';
|
import { VideoCameraOutlined } from '@ant-design/icons';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Spin } from 'antd';
|
import { Button, Spin, Tooltip } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import 'overlayscrollbars/overlayscrollbars.css';
|
import 'overlayscrollbars/overlayscrollbars.css';
|
||||||
import React, {
|
import React, {
|
||||||
@@ -18,6 +19,7 @@ import { CREATE_VIDEO_API } from '../apis';
|
|||||||
import MessageInput from '../components/message-input';
|
import MessageInput from '../components/message-input';
|
||||||
import RightContainer from '../components/right-container';
|
import RightContainer from '../components/right-container';
|
||||||
import ViewCommonCode from '../components/view-common-code';
|
import ViewCommonCode from '../components/view-common-code';
|
||||||
|
import { videoPromptList } from '../config';
|
||||||
import { useInitVideoMeta } from '../hooks/use-init-video-meta';
|
import { useInitVideoMeta } from '../hooks/use-init-video-meta';
|
||||||
import useTextVideo from '../hooks/use-text-video';
|
import useTextVideo from '../hooks/use-text-video';
|
||||||
import '../style/ground-llm.less';
|
import '../style/ground-llm.less';
|
||||||
@@ -38,7 +40,6 @@ const GroundVideo: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
const [collapse, setCollapse] = useState(false);
|
const [collapse, setCollapse] = useState(false);
|
||||||
const scroller = useRef<any>(null);
|
const scroller = useRef<any>(null);
|
||||||
const paramsRef = useRef<any>(null);
|
|
||||||
const inputRef = useRef<any>(null);
|
const inputRef = useRef<any>(null);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -46,7 +47,6 @@ const GroundVideo: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
handleToggleParamsStyle,
|
handleToggleParamsStyle,
|
||||||
setParams,
|
setParams,
|
||||||
form,
|
form,
|
||||||
formFields,
|
|
||||||
paramsConfig,
|
paramsConfig,
|
||||||
initialValues,
|
initialValues,
|
||||||
parameters,
|
parameters,
|
||||||
@@ -58,7 +58,6 @@ const GroundVideo: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
loading,
|
loading,
|
||||||
tokenResult,
|
tokenResult,
|
||||||
videoList,
|
videoList,
|
||||||
promptList,
|
|
||||||
currentPrompt,
|
currentPrompt,
|
||||||
setCurrentPrompt,
|
setCurrentPrompt,
|
||||||
handleClear,
|
handleClear,
|
||||||
@@ -86,8 +85,8 @@ const GroundVideo: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleRandomPrompt = useCallback(() => {
|
const handleRandomPrompt = useCallback(() => {
|
||||||
const randomIndex = generateNumber(0, promptList.length - 1);
|
const randomIndex = generateNumber(0, videoPromptList.length - 1);
|
||||||
const randomPrompt = promptList[randomIndex];
|
const randomPrompt = videoPromptList[randomIndex];
|
||||||
inputRef.current?.handleInputChange({
|
inputRef.current?.handleInputChange({
|
||||||
target: {
|
target: {
|
||||||
value: randomPrompt
|
value: randomPrompt
|
||||||
@@ -237,6 +236,22 @@ const GroundVideo: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
onInputChange={handleInputChange}
|
onInputChange={handleInputChange}
|
||||||
shouldResetMessage={false}
|
shouldResetMessage={false}
|
||||||
clearAll={handleClear}
|
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>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+1
-1
@@ -344,7 +344,7 @@ export const parseParamsString = (paramsString: string): string[] => {
|
|||||||
} else if (token.startsWith('-')) {
|
} else if (token.startsWith('-')) {
|
||||||
// Check if next token is a value (does not start with '-')
|
// Check if next token is a value (does not start with '-')
|
||||||
const nextToken = tokens[i + 1];
|
const nextToken = tokens[i + 1];
|
||||||
if (nextToken && !nextToken.startsWith('-')) {
|
if (nextToken && !nextToken.startsWith('-') && !nextToken.includes('=')) {
|
||||||
// If value is quoted, keep space format
|
// If value is quoted, keep space format
|
||||||
if (nextToken.startsWith('"') || nextToken.startsWith("'")) {
|
if (nextToken.startsWith('"') || nextToken.startsWith("'")) {
|
||||||
result.push(`${token} ${nextToken}`);
|
result.push(`${token} ${nextToken}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user