继续收敛配置与面板错误正文
保留模型发现、推理档和插件面板错误详情 补充字体预览与更新检查的安全错误文案
This commit is contained in:
@@ -4442,7 +4442,11 @@ pub(crate) async fn fetch_custom_llm_models(
|
||||
if !response.status().is_success() {
|
||||
let status = response.status();
|
||||
let body = response.text().await.unwrap_or_default();
|
||||
let detail = body.trim().chars().take(600).collect::<String>();
|
||||
let detail = crate::agent::redact_agent_runtime_error(
|
||||
Path::new("__agc_no_project_root__"),
|
||||
body.trim(),
|
||||
600,
|
||||
);
|
||||
return Err(if detail.is_empty() {
|
||||
format!("模型列表读取失败(HTTP {})", status.as_u16())
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
type LoadedUiEditorFontFace,
|
||||
loadUiEditorFontFace,
|
||||
} from '../../features/ui-editor/useUiEditorFontFaces';
|
||||
import { visibleClientErrorMessage } from '../../services/errorReporting';
|
||||
import type { AssetImporterPreviewProps } from './utils';
|
||||
|
||||
export function FontImporterPreview({
|
||||
@@ -52,7 +53,9 @@ export function FontImporterPreview({
|
||||
relativePath: selected.asset?.localPath,
|
||||
cause,
|
||||
});
|
||||
if (!cancelled) setError('字体样张加载失败');
|
||||
if (!cancelled) {
|
||||
setError(visibleClientErrorMessage(cause, '字体样张加载失败'));
|
||||
}
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
|
||||
import type { AgcPluginPanel } from '../../app/types';
|
||||
import { ThemedModal } from '../../components/modal/ThemedModal';
|
||||
import { visibleClientErrorMessage } from '../../services/errorReporting';
|
||||
import { readAgcPluginPanel } from '../../services/pluginHost';
|
||||
|
||||
export type PluginPanelHostProps = {
|
||||
@@ -30,8 +31,9 @@ export function PluginPanelHost({
|
||||
(result) => {
|
||||
if (active) setHtml(result.html);
|
||||
},
|
||||
() => {
|
||||
if (active) setError('插件面板加载失败');
|
||||
(error) => {
|
||||
if (active)
|
||||
setError(visibleClientErrorMessage(error, '插件面板加载失败'));
|
||||
},
|
||||
);
|
||||
return () => {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useEffect, useRef, useState } from 'react';
|
||||
import { PlatformTextField } from '../../../../../packages/shared/src/components/PlatformTextField';
|
||||
import { resolveTauriInvoke } from '../../app/tauri';
|
||||
import type { GameCreatorLlmConfig } from '../../app/types';
|
||||
import { visibleClientErrorMessage } from '../../services/errorReporting';
|
||||
|
||||
export function CustomLlmSettings({
|
||||
llm,
|
||||
@@ -54,7 +55,7 @@ export function CustomLlmSettings({
|
||||
} catch (error) {
|
||||
if (epoch !== requestEpoch.current) return;
|
||||
setStatus('');
|
||||
setError(typeof error === 'string' ? error : '模型列表读取失败,请重试');
|
||||
setError(visibleClientErrorMessage(error, '模型列表读取失败,请重试'));
|
||||
} finally {
|
||||
if (epoch === requestEpoch.current) setBusy(false);
|
||||
}
|
||||
|
||||
@@ -706,7 +706,9 @@ export function RuntimeConfigDialog({
|
||||
}
|
||||
} catch (error) {
|
||||
// 结果型入口已经收口了检查失败;这里只兜住调用方自身的意外抛错。
|
||||
setAppUpdateStatus('检查更新失败,请稍后重试');
|
||||
setAppUpdateStatus(
|
||||
`检查更新失败:${visibleClientErrorMessage(error, '请稍后重试')}`,
|
||||
);
|
||||
} finally {
|
||||
setAppUpdateChecking(false);
|
||||
}
|
||||
|
||||
+4
-4
@@ -342,9 +342,9 @@ export function ComposerReasoningEffortSelect({
|
||||
normalizeComposerReasoningEffort(view?.config?.llm?.reasoningEffort),
|
||||
);
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error) => {
|
||||
if (cancelled || !mountedRef.current) return;
|
||||
setNotice('推理档读取失败');
|
||||
setNotice(visibleClientErrorMessage(error, '推理档读取失败'));
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
@@ -378,10 +378,10 @@ export function ComposerReasoningEffortSelect({
|
||||
normalizeComposerReasoningEffort(view?.config?.llm?.reasoningEffort),
|
||||
);
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error) => {
|
||||
if (!mountedRef.current) return;
|
||||
setEffort(previous);
|
||||
setNotice('推理档保存失败');
|
||||
setNotice(visibleClientErrorMessage(error, '推理档保存失败'));
|
||||
})
|
||||
.finally(() => {
|
||||
if (mountedRef.current) {
|
||||
|
||||
Reference in New Issue
Block a user