@@ -13,7 +13,7 @@ import {
1313
1414import { Button } from "@/components/ui/Button"
1515import { Card , CardContent } from "@/components/ui/Card"
16- import { getUiErrorPresentation } from "@/lib/error-presenter"
16+ import { getUiErrorCtaText , getUiErrorPresentation } from "@/lib/error-presenter"
1717import { cn } from "@/lib/utils"
1818import { useGlobalApiConnectionState , useGlobalDirectorModeState , useGlobalLocaleState } from "@/lib/workbench-ui"
1919import { CinematicWorkspaceShell } from "@/components/workbench/CinematicWorkspaceShell"
@@ -146,24 +146,6 @@ interface CandidateTileProps {
146146
147147function CandidateTile ( { shotId, candidate, locale, onSelect, onReplace, disabled, compact } : CandidateTileProps ) {
148148 const txt = t ( locale )
149- const errorCtaLabel = ( ctaKey ?: string ) => {
150- if ( ! ctaKey ) return ""
151- const mapEn : Record < string , string > = {
152- check_provider_quota : "check BYOK provider quota" ,
153- check_api_base : "check API connection" ,
154- refresh_shots : "refresh shots" ,
155- check_fields : "check fields" ,
156- retry : "retry" ,
157- }
158- const mapZh : Record < string , string > = {
159- check_provider_quota : "检查 BYOK Provider 额度" ,
160- check_api_base : "检查 API 连接" ,
161- refresh_shots : "刷新分镜列表" ,
162- check_fields : "检查输入字段" ,
163- retry : "重试" ,
164- }
165- return ( locale === "zh-CN" ? mapZh : mapEn ) [ ctaKey ] || ""
166- }
167149 const score = candidate . score ?. total ?? 0
168150 const isSelected = candidate . selected || ( candidate . id && candidate . id === candidate . candidateId )
169151 const previewSrc = candidate . thumbnailUrl
@@ -343,7 +325,7 @@ export function VideoDesk() {
343325 addLog ( locale === "zh-CN" ? `已加载 ${ data . shots ?. length || 0 } 个分镜` : `Loaded ${ data . shots ?. length || 0 } shots` , undefined , "success" )
344326 } catch ( error ) {
345327 const ui = getUiErrorPresentation ( error , locale )
346- const cta = errorCtaLabel ( ui . ctaKey )
328+ const cta = getUiErrorCtaText ( locale , ui . ctaKey )
347329 addLog ( `${ locale === "zh-CN" ? "加载分镜失败" : "Load shots failed" } · ${ ui . message } ${ cta ? ` · ${ cta } ` : "" } ` , error , "error" )
348330 } finally {
349331 setIsLoading ( false )
@@ -373,7 +355,7 @@ export function VideoDesk() {
373355 await loadShots ( )
374356 } catch ( error ) {
375357 const ui = getUiErrorPresentation ( error , locale )
376- const cta = errorCtaLabel ( ui . ctaKey )
358+ const cta = getUiErrorCtaText ( locale , ui . ctaKey )
377359 addLog ( `${ locale === "zh-CN" ? `选择候选失败 (${ shotId } )` : `Select candidate failed (${ shotId } )` } · ${ ui . message } ${ cta ? ` · ${ cta } ` : "" } ` , error , "error" )
378360 } finally {
379361 setActiveShotId ( null )
@@ -395,7 +377,7 @@ export function VideoDesk() {
395377 await loadShots ( )
396378 } catch ( error ) {
397379 const ui = getUiErrorPresentation ( error , locale )
398- const cta = errorCtaLabel ( ui . ctaKey )
380+ const cta = getUiErrorCtaText ( locale , ui . ctaKey )
399381 addLog ( `${ locale === "zh-CN" ? `低分替换失败 (${ shotId } )` : `Replace low-score failed (${ shotId } )` } · ${ ui . message } ${ cta ? ` · ${ cta } ` : "" } ` , error , "error" )
400382 } finally {
401383 setActiveShotId ( null )
0 commit comments