Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

Update profile AI model

tianmaee5d0b9ca9d2
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index a7326b19..36202250 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -216,7 +216,7 @@ const PASSWORD_SALT_BYTES = 16;
const SESSION_TOKEN_BYTES = 32;
const DEFAULT_SESSION_TTL_DAYS = 30;
const DEFAULT_R2_BUCKET_NAME = "edgeever-resources";
-const DEFAULT_PROFILE_MODEL = "@cf/meta/llama-3.1-8b-instruct";
+const DEFAULT_PROFILE_MODEL = "@cf/zai-org/glm-5.2";
const PROFILE_MEMO_LIMIT = 200;
const PROFILE_MEMO_TEXT_LIMIT = 1200;
const PROFILE_CHUNK_CHAR_LIMIT = 12000;
diff --git a/apps/web/src/components/SettingsPane.tsx b/apps/web/src/components/SettingsPane.tsx
index b63a6155..8094b429 100644
--- a/apps/web/src/components/SettingsPane.tsx
+++ b/apps/web/src/components/SettingsPane.tsx
@@ -8,7 +8,7 @@ import { Checkbox } from "@/components/ui/checkbox";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { Switch } from "@/components/ui/switch";
-import { api } from "@/lib/api";
+import { ApiRequestError, api } from "@/lib/api";
import { EVERNOTE_MIGRATION_PATH } from "@/lib/routes";
import { cn, formatDateTime } from "@/lib/utils";
import { AppConfirmDialog } from "./dialogs/ConfirmDialogs";
@@ -148,6 +148,28 @@ const confidenceLabel: Record<ProfileSnapshot["sections"][number]["insights"][nu
high: "依据较多",
};
+const getProfileErrorMessage = (error: unknown) => {
+ if (!error) {
+ return undefined;
+ }
+
+ if (error instanceof ApiRequestError) {
+ if (error.code === "ai_request_failed") {
+ return "Cloudflare Workers AI 调用失败。请确认部署环境的 Workers AI 可用,或在环境变量 EDGE_EVER_PROFILE_MODEL 中指定一个当前可用的文本生成模型。";
+ }
+
+ if (error.code === "ai_not_configured") {
+ return "当前部署还没有配置 Workers AI binding,暂时无法生成人物画像。";
+ }
+
+ if (error.code === "no_profile_sources") {
+ return "还没有足够的有效笔记用于生成人物画像。";
+ }
+ }
+
+ return error instanceof Error ? error.message : "人物画像请求失败。";
+};
+
const PersonaProfileCard = ({ profile, isLoading, isGenerating, errorMessage, onGenerate }: PersonaProfileCardProps) => (
<Card className="w-full min-w-0 overflow-hidden shadow-none">
<CardHeader className="p-4">
@@ -814,7 +836,7 @@ export const SettingsPane = ({
profile={profile}
isLoading={profileQuery.isLoading}
isGenerating={generateProfileMutation.isPending}
- errorMessage={generateProfileMutation.error?.message ?? profileQuery.error?.message}
+ errorMessage={getProfileErrorMessage(generateProfileMutation.error ?? profileQuery.error)}
onGenerate={() => generateProfileMutation.mutate()}
/>
<EvernoteImportGuideCard onShowGuide={onShowGuide} />