初始化模版工程

This commit is contained in:
Cloud Bot
2026-03-20 07:33:46 +00:00
commit 23717e0ecd
386 changed files with 51675 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import { useEffect, useState } from 'react';
import { useNovaKit } from '@/components/nova-sdk/context/useNovaKit';
import type { TaskArtifact } from '@/components/nova-sdk/types';
export const useLoadContent = (
taskArtifact: TaskArtifact
) => {
const [content, setContent] = useState('');
const { api } = useNovaKit();
useEffect(() => {
if (taskArtifact.path) {
api
.getArtifactUrl?.(taskArtifact)
.then(async (res) => {
const url = res?.data || '';
if (url) {
const content = await fetch(url).then((res) => res.text());
setContent(content);
}
})
.catch(() => { });
}
}, [taskArtifact, api]);
return content;
};