This commit is contained in:
hailin 2025-06-23 12:00:38 +08:00
parent d57f222683
commit 1bb5e03fcf
1 changed files with 1 additions and 55 deletions

View File

@ -542,60 +542,6 @@ export function DetailPageHeader({ data }: { data: any }) {
)}
{!data?.model_parameter && (
<button
onClick={async () => {
try {
const download_url = data?.extra_data?.download_url;
const callback_url = data?.extra_data?.callback_url
const size = data?.extra_data?.size;
const id = data?.id;
if (!download_url || !size || !id) {
message.warning("缺少必要的下载参数");
return;
}
console.log("📥 调用下载接口...", { url: download_url, size, id });
const res = await fetch("https://ai.szaiai.com/api/v1/cloud/download", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
url: download_url,
callback_url: callback_url,
size: size,
id: id,
}),
});
const result = await res.json();
console.log("✅ 下载接口返回:", result);
if (result?.header?.code === 0) {
const downloaded = result?.data?.downloaded;
const total = result?.data?.total;
const percent = total > 0 ? ((downloaded / total) * 100).toFixed(2) : "0";
message.success(`📦 下载进度:${downloaded} / ${total} 字节(${percent}%`);
} else {
message.warning(`❌ 下载失败:${result?.header?.message || "未知错误"}`);
}
} catch (err) {
console.error("❌ 下载请求异常:", err);
message.error("请求出错,无法下载");
}
}}
className="hover:text-gray-700 transition self-end"
title="下载模型文件"
>
<CloudDownload size={20} />
</button>
)}
{/* {!data?.model_parameter && (
<div className="flex flex-col items-center gap-[2px]">
<button
onClick={async () => {
@ -668,7 +614,7 @@ export function DetailPageHeader({ data }: { data: any }) {
</div>
)}
</div>
)} */}
)}
</div>