feat: add official game audio generation client
This commit is contained in:
1 parent
d222d17500
commit
09e0ce5cf3
28 files changed
+1835
-31
No files matched your search
@@ -64,6 +64,7 @@ import type {
|
||||
} from '../../../shared/coding-conversation-contracts';
|
||||
import { CodingAttachmentPreview } from './CodingAttachmentPreview';
|
||||
import { CodingWelcomeHero } from './CodingWelcomeHero';
|
||||
import { GameAudioFiles } from './GameAudioFiles';
|
||||
|
||||
const EMPTY_NODES: ConversationNode[] = [];
|
||||
const IDLE_RUN: ConversationRunState = { status: 'idle' };
|
||||
@@ -105,26 +106,29 @@ function capabilityBillingLabel(billing: CapabilityToolDetails['billing']): stri
|
||||
}
|
||||
|
||||
function gameResourceProgressLabel(details: CapabilityToolDetails): string | null {
|
||||
if (details.plugin_id !== 'makelore.game-resource' || details.operation !== 'generate'
|
||||
if (!['makelore.game-resource', 'makelore.game-audio'].includes(details.plugin_id)
|
||||
|| !['generate', 'preview'].includes(details.operation)
|
||||
|| !details.data || typeof details.data !== 'object' || Array.isArray(details.data)) return null;
|
||||
const data = details.data as Record<string, unknown>;
|
||||
const label = details.plugin_id === 'makelore.game-audio' ? '游戏音频' : '游戏资源';
|
||||
const phase = typeof data.phase === 'string' ? data.phase : null;
|
||||
const deliveryStatus = typeof data.deliveryStatus === 'string' ? data.deliveryStatus : null;
|
||||
const providerStatus = typeof data.providerStatus === 'string' ? data.providerStatus : null;
|
||||
const outputCount = Number.isSafeInteger(data.outputCount) ? data.outputCount as number : 0;
|
||||
if (phase === 'saved' || deliveryStatus === 'saved') {
|
||||
return `游戏资源 · 已保存 ${outputCount} 个文件`;
|
||||
return `${label} · 已保存 ${outputCount} 个文件`;
|
||||
}
|
||||
if (phase === 'saving' || deliveryStatus === 'saving') return '游戏资源 · 正在保存到项目';
|
||||
if (deliveryStatus === 'delivery_failed') return '游戏资源 · 自动保存失败,等待重试';
|
||||
if (phase === 'submitted') return '游戏资源 · 已提交';
|
||||
if (phase === 'saving' || deliveryStatus === 'saving') return label + ' · 正在保存到项目';
|
||||
if (deliveryStatus === 'delivery_failed') return label + ' · 自动保存失败,等待恢复';
|
||||
if (deliveryStatus === 'needs_reconciliation') return label + ' · 等待原任务状态恢复,请勿重复生成';
|
||||
if (phase === 'submitted') return label + ' · 已提交';
|
||||
if (phase === 'generating' || ['reserved', 'accepted', 'running'].includes(providerStatus ?? '')) {
|
||||
return '游戏资源 · 正在生成';
|
||||
return label + ' · 正在生成';
|
||||
}
|
||||
if (providerStatus === 'pending_review') return '游戏资源 · 账单待审核';
|
||||
if (providerStatus === 'submission_unknown') return '游戏资源 · 提交状态待确认';
|
||||
if (providerStatus === 'cancelled') return '游戏资源 · 已取消';
|
||||
if (providerStatus === 'failed') return '游戏资源 · 生成失败';
|
||||
if (providerStatus === 'pending_review') return label + ' · 账单待审核';
|
||||
if (providerStatus === 'submission_unknown') return label + ' · 提交状态待确认';
|
||||
if (providerStatus === 'cancelled') return label + ' · 已取消';
|
||||
if (providerStatus === 'failed') return label + ' · 生成失败';
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -652,6 +656,7 @@ const ToolDetails = memo(function ToolDetails({ details }: { details: KnownToolD
|
||||
{details.success ? '成功' : details.error ?? '请求失败'} · HTTP {details.status}
|
||||
</p>
|
||||
<p className="mt-1 text-muted-foreground">{capabilityBillingLabel(details.billing)}</p>
|
||||
{details.plugin_id === 'makelore.game-audio' && <GameAudioFiles data={details.data} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user