修复类型问题

This commit is contained in:
北枳 2025-08-17 20:17:47 +08:00
parent ab3eecc3ea
commit ea7e336d1e
4 changed files with 13 additions and 7 deletions

View File

@ -85,7 +85,8 @@ export interface UseScriptService {
userId: string, userId: string,
mode: "automatic" | "manual", mode: "automatic" | "manual",
resolution: string, resolution: string,
language: string language: string,
video_duration: string
) => Promise<void>; ) => Promise<void>;
/** 设置任何属性 */ /** 设置任何属性 */
setAnyAttribute: any; setAnyAttribute: any;
@ -158,7 +159,8 @@ export const useScriptService = (): UseScriptService => {
userId: string, userId: string,
mode: "automatic" | "manual", mode: "automatic" | "manual",
resolution: string, resolution: string,
language: string language: string,
video_duration: string
): Promise<void> => { ): Promise<void> => {
try { try {
setLoading(true); setLoading(true);
@ -169,7 +171,8 @@ export const useScriptService = (): UseScriptService => {
userId, userId,
mode as "automatic" | "manual", mode as "automatic" | "manual",
resolution as "720p" | "1080p" | "4k", resolution as "720p" | "1080p" | "4k",
language language,
video_duration
); );
setProjectId(projectData.project_id); setProjectId(projectData.project_id);

View File

@ -60,10 +60,10 @@ export class TextToShotAdapter {
let currentText = text; let currentText = text;
// 按角色名称长度降序排序,避免短名称匹配到长名称的一部分 // 按角色名称长度降序排序,避免短名称匹配到长名称的一部分
// 既要兼容 首字母大写 其余小写、还要兼容 全部大写 // 既要兼容 每个单词 首字母大写 其余小写、还要兼容 全部大写
const sortedRoles = [...roles].sort((a, b) => b.name.length - a.name.length).map(role => ({ const sortedRoles = [...roles].sort((a, b) => b.name.length - a.name.length).map(role => ({
...role, ...role,
name: role.name.charAt(0).toUpperCase() + role.name.slice(1).toLowerCase() name: role.name.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ')
})).concat([...roles].map(role => ({ })).concat([...roles].map(role => ({
...role, ...role,
name: role.name.toUpperCase() name: role.name.toUpperCase()

View File

@ -40,7 +40,8 @@ describe("ScriptService 业务逻辑测试", () => {
"user123", "user123",
"automatic", "automatic",
"720p", "720p",
"en" "en",
"10"
); );
expect(createRes.project_id).toBeDefined(); expect(createRes.project_id).toBeDefined();
projectId = createRes.project_id; projectId = createRes.project_id;

View File

@ -126,7 +126,8 @@ export class ScriptEditUseCase {
userId: string , userId: string ,
mode: "automatic" | "manual" = "automatic", mode: "automatic" | "manual" = "automatic",
resolution: "720p" | "1080p" | "4k" = "720p", resolution: "720p" | "1080p" | "4k" = "720p",
language: string language: string,
video_duration: string
) { ) {
try { try {
// 调用创建项目API // 调用创建项目API
@ -136,6 +137,7 @@ export class ScriptEditUseCase {
mode, mode,
resolution, resolution,
language, language,
video_duration,
}); });
if (!response.successful) { if (!response.successful) {