/** * 组件注册表 - 直接使用 catalog.prompt() 运行时生成 */ 'use client'; import { getCatalogPrompt } from './catalog/catalog'; export interface ComponentConfig { type: string; description: string; schema: Record; } /** * 获取组件提示词(同步) * 直接调用 catalog.prompt() 运行时生成 */ export function generateComponentsPrompt(): string { return getCatalogPrompt(); } /** * 异步获取组件提示词(兼容旧代码) */ export async function getComponentsPromptAsync(): Promise { return getCatalogPrompt(); } /** * 预加载(空操作) */ export function preloadComponentsPrompt(): void {} /** * 清除缓存(空操作) */ export function invalidateComponentsPromptCache(): void {} // 组件定义(向后兼容) export const AVAILABLE_COMPONENTS: Record = { 'translation-result': { type: 'translation-result', description: '翻译结果卡片', schema: { translated: '译文', termsUsed: '术语列表' } }, 'novel-list': { type: 'novel-list', description: '小说列表卡片', schema: { novels: '小说数组' } }, 'card': { type: 'card', description: '卡片容器', schema: { title: '标题', children: '子元素' } }, 'stack': { type: 'stack', description: '布局容器', schema: { direction: '方向', spacing: '间距' } }, 'heading': { type: 'heading', description: '标题', schema: { text: '文本', level: '级别' } }, 'text': { type: 'text', description: '文本', schema: { text: '内容' } }, 'button': { type: 'button', description: '按钮', schema: { label: '文本' } }, 'badge': { type: 'badge', description: '徽章', schema: { text: '文本' } }, 'code-block': { type: 'code-block', description: '代码块', schema: { code: '代码', language: '语言' } }, 'tool-call': { type: 'tool-call', description: '工具调用状态', schema: { toolName: '名称', status: '状态' } } };