增加前端运行时后端地址配置
This commit is contained in:
@@ -5,6 +5,7 @@ import type { DictionaryResponse, ModelItem, ModelListResponse } from "../../../
|
||||
import { confirmDialog, formDialog, notify, notifyError } from "../../../ui/dialogs";
|
||||
import { downloadFileFromUrl } from "../../../utils/fileDownload";
|
||||
import { escapeHtml, modelNameFromFile } from "../../../utils/format";
|
||||
import { resolveStorageUrl } from "../../../config/runtime";
|
||||
import { appState } from "../appState";
|
||||
|
||||
type UploadFormState = {
|
||||
@@ -287,7 +288,7 @@ function renderModelCard(item: ModelItem) {
|
||||
const canWrite = item.permissions.write;
|
||||
const prop = item.properties ?? {};
|
||||
const thumb = item.thumbnail_url
|
||||
? `<img src="${item.thumbnail_url}" alt="" />`
|
||||
? `<img src="${resolveStorageUrl(item.thumbnail_url)}" alt="" />`
|
||||
: `<div class="thumb-placeholder">暂无预览图</div>`;
|
||||
return `
|
||||
<article class="model-card" data-model-id="${item.id}">
|
||||
|
||||
@@ -9,6 +9,7 @@ import { downloadFileFromUrl } from "../../../utils/fileDownload";
|
||||
import { escapeHtml, formatBytes } from "../../../utils/format";
|
||||
import { notify, notifyError } from "../../../ui/dialogs";
|
||||
import { api } from "../../../services/api";
|
||||
import { resolveStorageUrl } from "../../../config/runtime";
|
||||
|
||||
type PreviewRuntime = {
|
||||
renderer: WebGLRenderer;
|
||||
@@ -146,7 +147,7 @@ export function openModelPreview(
|
||||
) {
|
||||
const context = beginPreviewContext();
|
||||
const canWrite = model.permissions.write;
|
||||
const url = model.file_url;
|
||||
const url = resolveStorageUrl(model.file_url);
|
||||
const operations = parseModelOperations(model.operation_tree);
|
||||
const popup = w2popup.open({
|
||||
title: `模型预览 - ${escapeHtml(model.name)}【${formatBytes(model.file_size)}】`,
|
||||
@@ -300,7 +301,7 @@ function buildParentImportScenePayload(payload: PreviewImportScenePayload): Pare
|
||||
id: payload.model.id,
|
||||
name: payload.model.name,
|
||||
original_filename: payload.model.original_filename,
|
||||
file_url: payload.model.file_url
|
||||
file_url: resolveStorageUrl(payload.model.file_url)
|
||||
},
|
||||
modelUrl: payload.modelUrl,
|
||||
basePointEnabled: payload.basePointEnabled,
|
||||
@@ -739,7 +740,7 @@ function buildImportScenePayload(options: {
|
||||
}): PreviewImportScenePayload {
|
||||
return {
|
||||
model: options.model,
|
||||
modelUrl: options.model.file_url,
|
||||
modelUrl: resolveStorageUrl(options.model.file_url),
|
||||
basePointEnabled: options.basePointEnabled,
|
||||
basePoint: options.basePoint,
|
||||
rawOperationTree: options.model.operation_tree,
|
||||
|
||||
Reference in New Issue
Block a user