feat(agent): 支持工具执行结果中的图片和视频资产预览
在聊天消息组件中添加资产灯箱预览功能,支持展示工具调用返回的图片和视频资源。新增 `AssetLightbox` 组件用于全屏浏览资产,并扩展消息类型以包含资产元数据。同时引入 `@radix-ui/react-select` 依赖并为服务端添加资产 URL 转换工具函数。
This commit is contained in:
@@ -16,6 +16,15 @@ export function loadJSON(filePath: string): unknown {
|
||||
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
||||
}
|
||||
|
||||
export function manifestRelToUrl(manifestPath: string, relPath: string): string {
|
||||
if (!relPath) return '';
|
||||
if (relPath.startsWith('http://') || relPath.startsWith('https://')) return relPath;
|
||||
const manifestDir = path.dirname(path.resolve(manifestPath));
|
||||
const absPath = path.resolve(manifestDir, relPath);
|
||||
const relToRoot = path.relative(PROJECT_ROOT, absPath).replace(/\\/g, '/');
|
||||
return `/api/assets/file?path=${encodeURIComponent(relToRoot)}`;
|
||||
}
|
||||
|
||||
export function runInit(params: {
|
||||
account: string;
|
||||
mode: string;
|
||||
|
||||
Reference in New Issue
Block a user