fix: rowid column shift in get_message_with_rowid; add file logging and frontend error reporting
This commit is contained in:
+19
-1
@@ -1,10 +1,28 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { invoke as rawInvoke } from "@tauri-apps/api/core";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
|
||||
/** 统一命令包装:失败时自动上报错误到本地日志,再抛出给界面。 */
|
||||
async function invoke<T>(command: string, args?: Record<string, unknown>): Promise<T> {
|
||||
try {
|
||||
return await rawInvoke<T>(command, args);
|
||||
} catch (error) {
|
||||
try {
|
||||
await rawInvoke("report_error", {
|
||||
source: command,
|
||||
message: String(error),
|
||||
});
|
||||
} catch {
|
||||
// 上报失败不影响主流程
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export interface AppInfo {
|
||||
version: string;
|
||||
platform: string;
|
||||
models_dir: string;
|
||||
logs_dir: string;
|
||||
engine_bin: string | null;
|
||||
engine_exists: boolean;
|
||||
db_path: string;
|
||||
|
||||
@@ -30,6 +30,19 @@ export default function SettingsPage() {
|
||||
<div>
|
||||
数据目录:<span className="text-slate-300">{info?.db_path}</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<span>
|
||||
日志目录:<span className="text-slate-300">{info?.logs_dir}</span>
|
||||
</span>
|
||||
{info?.logs_dir ? (
|
||||
<button
|
||||
className="text-xs text-slate-400 hover:text-slate-200"
|
||||
onClick={() => api.openPath(info.logs_dir!)}
|
||||
>
|
||||
打开
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
<div>
|
||||
引擎可用:
|
||||
{info?.engine_exists ? (
|
||||
@@ -103,4 +116,3 @@ function SettingInput({
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user