收敛资源预览与编辑错误正文
保留模型预览和资源编辑的安全错误详情
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { ChevronLeft, LoaderCircle, Sparkles } from 'lucide-react';
|
||||
import { type FormEvent, useState } from 'react';
|
||||
|
||||
import { visibleClientErrorMessage } from '../../services/errorReporting';
|
||||
import {
|
||||
type LocalProjectResourceEditKind,
|
||||
resourceEditPromptMaxLength,
|
||||
@@ -50,11 +51,7 @@ export function ResourceEditSurface({
|
||||
try {
|
||||
await onSubmit({ prompt: normalizedPrompt, assetName: normalizedName });
|
||||
} catch (submitError) {
|
||||
setError(
|
||||
submitError instanceof Error
|
||||
? submitError.message
|
||||
: String(submitError),
|
||||
);
|
||||
setError(visibleClientErrorMessage(submitError, '资源编辑失败,请重试'));
|
||||
setSubmitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { visibleClientErrorMessage } from '../../services/errorReporting';
|
||||
import {
|
||||
addResourceModelLights,
|
||||
disposeResourceModelObject,
|
||||
@@ -61,9 +62,8 @@ export function ResourceModelViewer({
|
||||
void (async () => {
|
||||
try {
|
||||
const THREE = await import('three');
|
||||
const { OrbitControls } = await import(
|
||||
'three/examples/jsm/controls/OrbitControls.js'
|
||||
);
|
||||
const { OrbitControls } =
|
||||
await import('three/examples/jsm/controls/OrbitControls.js');
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
@@ -154,11 +154,7 @@ export function ResourceModelViewer({
|
||||
} catch (viewerError) {
|
||||
if (!disposed) {
|
||||
setStatus('failed');
|
||||
setError(
|
||||
viewerError instanceof Error
|
||||
? viewerError.message
|
||||
: String(viewerError),
|
||||
);
|
||||
setError(visibleClientErrorMessage(viewerError, '模型预览加载失败'));
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user