diff --git a/.github/workflows/octop-desktop.yml b/.github/workflows/octop-desktop.yml index 78e866700c..52fb362fc9 100644 --- a/.github/workflows/octop-desktop.yml +++ b/.github/workflows/octop-desktop.yml @@ -101,7 +101,7 @@ jobs: all_plats = [ {"plat": "linux-amd64", "arch": "amd64", "os": "ubuntu-latest"}, {"plat": "linux-arm64", "arch": "arm64", "os": "ubuntu-24.04-arm"}, - {"plat": "darwin-arm64", "arch": "arm64", "os": "macos-14"}, + {"plat": "darwin-arm64", "arch": "arm64", "os": "macos-15"}, {"plat": "darwin-amd64", "arch": "amd64", "os": "macos-15-intel"}, {"plat": "windows-amd64", "arch": "amd64", "os": "windows-latest"}, {"plat": "windows-arm64", "arch": "arm64", "os": "windows-11-arm"}, diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b01a8c67f..a6c898397d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,22 @@ ## [Unreleased] +### 新增 +- 专家市场默认打开「精选」,用书签标出接入市场前随安装包提供的 22 个专家模板 + +### 修复 +- 错误帧信封保留 OctopError 的错误码与本地化文案(此前被兜底 catch 丢弃) +- 关机时会等正在进行的数据库查询结束再关闭连接,避免 Windows 上测试进程被访问冲突打断 +- 模型池里的优先模型可以取消,并且不再显示为聊天框里的选中模型。聊天框只显示专家默认模型或这场对话的手选模型 +- 添加云端协同时,权限不足、连接被占用、连到本机或达到条数上限会立刻显示可读错误,不再重试原始关闭帧 +- 同一专家的不同会话不再互相取消正在等待的提问。侧栏展开时可以拖右缘改宽度 +- 重名的模型供应商返回冲突,不再报服务器错误。知识库引用只包含实际写进上下文的文档 +- 备份落到另一块磁盘时不再丢文件。两个账号在同一浏览器里不再共用主题 +- 未读数字可以打开对应会话。自定义 ACP 显示自己的名称,HTML 预览里的页内链接留在预览框内 +- 供应商的默认模型可以清空并保持为空。对话里的模型名与选择时一致,能区分不同厂家的同名模型 +- 服务端升级后,登录页和已登录页面都会提示刷新前端。PostgreSQL 备份缺少客户端工具时会说明原因,Docker 镜像带上该工具 +- 专家配置文件改为文本框编辑,打开时不再停在编辑器加载中 + ## [1.0.3b4] - 2026-11-06 ### 新增 @@ -70,6 +86,7 @@ - 表单和对话可以让 AI 润色。搜索增加 DeepSeek 与元宝,模型支持 OpenAI Responses API ### 修复 +- 记忆配置 API 支持独立开关自动记录对话与自动注入召回结果,显式关闭时正确传递到运行时,避免配置被静默忽略(#2282)。 - 云端协同共享后可以直接对话。回复进行中不会被刷新冲掉,也不能删掉这场会话 - 手机截图写到专家自己的工作区。只改定时任务文案时,间隔任务不再重新计时 - 浏览器工作台恢复中文输入。主动关怀等对话安静后再发 diff --git a/dashboard/src/App.tsx b/dashboard/src/App.tsx index d278fadbbf..3a0384607a 100644 --- a/dashboard/src/App.tsx +++ b/dashboard/src/App.tsx @@ -19,6 +19,7 @@ import OidcComplete from "./pages/Login/OidcComplete"; import SetupPage from "./pages/Setup"; import InvitePage from "./pages/Invite"; import AuthGuard from "./components/AuthGuard"; +import PwaUpdatePrompt from "./components/PwaUpdatePrompt"; import OctopSpinner from "./components/OctopSpinner"; import { AntdAppProvider } from "./components/AntdAppProvider"; import GlobalErrorBoundary from "./components/ErrorBoundary"; @@ -132,6 +133,7 @@ function ThemedApp() { {desktopChrome ? ( ) : null} + } /> } /> diff --git a/dashboard/src/api/modules/expertMarket.ts b/dashboard/src/api/modules/expertMarket.ts index 1e2b701129..44d73ace36 100644 --- a/dashboard/src/api/modules/expertMarket.ts +++ b/dashboard/src/api/modules/expertMarket.ts @@ -26,6 +26,8 @@ export interface MarketExpert { skill_slugs?: string[]; skill_count?: number; source?: string; + /** True when this card is a template that ships with Octop. */ + featured?: boolean; content?: LocalizedText; quick_prompts?: ExpertMarketQuickPrompt[]; task_examples?: { zh?: string[]; en?: string[] } | null; diff --git a/dashboard/src/api/modules/octopThreads.ts b/dashboard/src/api/modules/octopThreads.ts index 75fa014ec7..7f5d39ff0b 100644 --- a/dashboard/src/api/modules/octopThreads.ts +++ b/dashboard/src/api/modules/octopThreads.ts @@ -67,6 +67,10 @@ export interface OctopThread { turn_active?: boolean; /** True when this thread is paused on a HITL approval or question. */ awaiting_user?: boolean; + /** Shared with other users who can open this expert. */ + contributed?: boolean; + /** False when the thread was contributed by someone else. */ + owned?: boolean; } export interface OctopThreadHistory { @@ -117,6 +121,7 @@ export interface ThreadDeleteResult { export interface OctopThreadPatch { title?: string; pinned?: boolean; + contributed?: boolean; model_ref?: string | null; reasoning_mode?: "auto" | "enabled" | "disabled" | null; reasoning_effort?: string | null; @@ -240,6 +245,8 @@ export const octopThreadsApi = { thread_id: string; title: string | null; pinned?: boolean; + contributed?: boolean; + owned?: boolean; model_ref?: string | null; reasoning_mode?: "auto" | "enabled" | "disabled" | null; reasoning_effort?: string | null; diff --git a/dashboard/src/components/AuthGuard.tsx b/dashboard/src/components/AuthGuard.tsx index 4a4c3af4d9..2d2e508cfe 100644 --- a/dashboard/src/components/AuthGuard.tsx +++ b/dashboard/src/components/AuthGuard.tsx @@ -6,6 +6,7 @@ import { authApi, type OctopUser } from "../api/modules/auth"; import { applyUserLocale } from "../utils/locale"; import { isNetworkFetchError } from "../utils/networkError"; import { CurrentUserProvider } from "../hooks/useCurrentUser"; +import { useTheme } from "../context/ThemeContext"; import BootOfflinePanel from "./BootOfflinePanel"; interface AuthGuardProps { @@ -42,6 +43,11 @@ export default function AuthGuard({ children }: AuthGuardProps) { const [checking, setChecking] = useState(true); const [authed, setAuthed] = useState(false); const [user, setUser] = useState(null); + const { bindUser } = useTheme(); + useEffect(() => { + bindUser(user?.id ?? null); + return () => bindUser(null); + }, [user?.id, bindUser]); const [offline, setOffline] = useState(false); const [retryKey, setRetryKey] = useState(0); diff --git a/dashboard/src/components/PwaUpdatePrompt/index.module.less b/dashboard/src/components/PwaUpdatePrompt/index.module.less index 6f7b02b0d2..c04136dd5b 100644 --- a/dashboard/src/components/PwaUpdatePrompt/index.module.less +++ b/dashboard/src/components/PwaUpdatePrompt/index.module.less @@ -12,7 +12,8 @@ border: 1px solid var(--fn-border-primary, rgba(255, 255, 255, 0.08)); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); z-index: 9999; - white-space: nowrap; + max-width: calc(100vw - 24px); + flex-wrap: wrap; animation: slideUp 0.25s ease; } diff --git a/dashboard/src/components/PwaUpdatePrompt/index.tsx b/dashboard/src/components/PwaUpdatePrompt/index.tsx index 287267086b..d898833ff9 100644 --- a/dashboard/src/components/PwaUpdatePrompt/index.tsx +++ b/dashboard/src/components/PwaUpdatePrompt/index.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { applyUpdate } from "../../pwa"; +import { applyUpdate, hasPendingAppUpdate } from "../../pwa"; import { updateApi } from "../../api/modules/update"; import { useCurrentUser } from "../../hooks/useCurrentUser"; import { userCan } from "../../utils/permissions"; @@ -16,14 +16,16 @@ export const PWA_UPDATE_DISMISSED_KEY = "pwa:update-dismissed"; /** * Listens for the "pwa:update-ready" event (dispatched by sw-register.ts) and * renders a dismissible banner so the user can choose when to reload. - * Designed to be mounted once in MainLayout. + * Mount once above the router so the login page sees it too. If the event + * fired before this component mounted, the waiting worker is checked directly. * - * Only users allowed to update see the banner: applying it restarts the backend - * service, which requires the ``update`` permission. Non-admins are not prompted. + * The banner is shown on every page, including login. Reloading picks up the + * new frontend. + * Restarting the backend service still requires the ``update`` permission. * * When the process is running as a system service (OCTOP_SERVICE_MODE is - * set), clicking the update-now action also triggers a backend service restart so that - * the new Python package takes effect alongside the new frontend bundle. + * set) and the user may update, clicking the action also restarts the backend + * so the new Python package takes effect alongside the new frontend bundle. */ export default function PwaUpdatePrompt() { const { t } = useTranslation(); @@ -34,16 +36,23 @@ export default function PwaUpdatePrompt() { const canUpdate = userCan(user, "update"); useEffect(() => { - const handler = () => { + let cancelled = false; + const show = () => { try { if (sessionStorage.getItem(PWA_UPDATE_DISMISSED_KEY)) return; } catch { // private mode / storage disabled — still allow the prompt } - setVisible(true); + if (!cancelled) setVisible(true); + }; + window.addEventListener("pwa:update-ready", show); + void hasPendingAppUpdate().then((pending) => { + if (pending) show(); + }); + return () => { + cancelled = true; + window.removeEventListener("pwa:update-ready", show); }; - window.addEventListener("pwa:update-ready", handler); - return () => window.removeEventListener("pwa:update-ready", handler); }, []); // Fetch service mode once so we know whether to also restart the backend. @@ -55,13 +64,13 @@ export default function PwaUpdatePrompt() { .catch(() => {}); }, [canUpdate]); - if (!canUpdate || !visible) return null; + if (!visible) return null; const handleUpdate = async () => { setVisible(false); - // If running as a system service, trigger backend restart first. - // applyUpdate() reloads once after posting SKIP_WAITING. - if (serviceMode) { + // Frontend reload is enough for everyone. Only an operator may restart + // the backend service that is serving this page. + if (canUpdate && serviceMode) { updateApi.restartService().catch(() => {}); } await applyUpdate(); diff --git a/dashboard/src/components/RailEdgeControl.module.less b/dashboard/src/components/RailEdgeControl.module.less index 2bc3d47587..cb00a1a8de 100644 --- a/dashboard/src/components/RailEdgeControl.module.less +++ b/dashboard/src/components/RailEdgeControl.module.less @@ -30,6 +30,12 @@ width: 12px; } +.edgePassThrough { + /* The rail itself must not cover a resize handle. The collapse button + stays pointer-events: none until a hover rule reveals it. */ + pointer-events: none; +} + .line { position: absolute; top: 0; diff --git a/dashboard/src/components/RailEdgeControl.tsx b/dashboard/src/components/RailEdgeControl.tsx index 652b326850..1cfea31021 100644 --- a/dashboard/src/components/RailEdgeControl.tsx +++ b/dashboard/src/components/RailEdgeControl.tsx @@ -25,6 +25,11 @@ interface RailEdgeControlProps { * ``before`` / ``after`` sit on either side when two rails share one line. */ placement?: "center" | "before" | "after"; + /** + * Let pointer events fall through the rail so a resize handle underneath + * stays usable. The collapse button itself still receives clicks. + */ + passThrough?: boolean; } /** @@ -39,6 +44,7 @@ export default function RailEdgeControl({ className, showLine = true, placement = "center", + passThrough = false, }: RailEdgeControlProps) { const { t } = useTranslation(); const ariaLabel = @@ -53,6 +59,7 @@ export default function RailEdgeControl({ styles.edge, side === "start" ? styles.edgeStart : styles.edgeEnd, !expanded && styles.edgeCollapsed, + passThrough && styles.edgePassThrough, className, )} > diff --git a/dashboard/src/context/AgentContext.test.ts b/dashboard/src/context/AgentContext.test.ts index 7f16bff924..c5f2e4a95c 100644 --- a/dashboard/src/context/AgentContext.test.ts +++ b/dashboard/src/context/AgentContext.test.ts @@ -253,6 +253,27 @@ describe("mapBridgeAgent", () => { expect(mapped.owner_username).toBe("Alice"); }); + it("keeps a shared peer expert's default model for the chat picker", () => { + const mapped = mapBridgeAgent( + { + agent_id: "bridge:cid:01AGENT", + name: "Peer", + is_owner: false, + is_shared: true, + default_model: "prov/shared-default", + }, + { + ...conn, + is_owner: false, + owner_username: "alice", + owner_display_name: "Alice", + }, + ); + expect(mapped.is_shared).toBe(true); + expect(mapped.is_owner).toBe(false); + expect(mapped.default_model).toBe("prov/shared-default"); + }); + it("keeps management when this user owns the link and the peer owns the expert", () => { const mapped = mapBridgeAgent( { diff --git a/dashboard/src/context/ThemeContext.tsx b/dashboard/src/context/ThemeContext.tsx index 7d6c02ac15..a79c2d048f 100644 --- a/dashboard/src/context/ThemeContext.tsx +++ b/dashboard/src/context/ThemeContext.tsx @@ -4,10 +4,13 @@ import { useState, useEffect, useCallback, + useRef, type ReactNode, } from "react"; import { + defaultAppearance, loadAppearanceOnBoot, + readStoredAppearance, writeStoredAppearance, type ThemePreference, } from "../styles/appearanceStorage"; @@ -43,6 +46,8 @@ interface ThemeContextValue { toggle: () => void; /** Whether the current mode is considered "dark" for Ant Design */ isDark: boolean; + /** Load the signed-in user's palette. ``null`` restores the shared boot theme. */ + bindUser: (userId: number | null) => void; } const ThemeContext = createContext({ @@ -55,6 +60,7 @@ const ThemeContext = createContext({ setCustomColor: () => {}, toggle: () => {}, isDark: false, + bindUser: () => {}, }); function resolveMode(pref: ThemePreference): ThemeMode { @@ -91,6 +97,27 @@ export function ThemeProvider({ children }: { children: ReactNode }) { ); const [mode, setMode] = useState(() => resolveMode(preference)); + const userIdRef = useRef(null); + + const bindUser = useCallback((userId: number | null) => { + if (userIdRef.current === userId) return; + const previous = userIdRef.current; + userIdRef.current = userId; + if (userId == null) { + if (previous != null) { + const defaults = defaultAppearance(); + setPreferenceState(defaults.preference); + setPaletteState(defaults.palette); + setCustomColorState(defaults.customColor ?? ""); + writeStoredAppearance(defaults, null); + } + return; + } + const stored = readStoredAppearance(userId); + setPreferenceState(stored.preference); + setPaletteState(stored.palette); + setCustomColorState(stored.customColor ?? ""); + }, []); // Listen for system color scheme changes when preference is "system" useEffect(() => { @@ -111,7 +138,10 @@ export function ThemeProvider({ children }: { children: ReactNode }) { // Persist preference + palette together (mode is derived, not stored) useEffect(() => { - writeStoredAppearance({ preference, palette, customColor }); + writeStoredAppearance( + { preference, palette, customColor }, + userIdRef.current, + ); document.documentElement.setAttribute("data-palette", palette); }, [preference, palette, customColor]); @@ -185,6 +215,7 @@ export function ThemeProvider({ children }: { children: ReactNode }) { setCustomColor, toggle, isDark: isDarkMode(mode), + bindUser, }} > {children} diff --git a/dashboard/src/hooks/useAuthImageSrc.test.ts b/dashboard/src/hooks/useAuthImageSrc.test.ts new file mode 100644 index 0000000000..95f0ed890a --- /dev/null +++ b/dashboard/src/hooks/useAuthImageSrc.test.ts @@ -0,0 +1,38 @@ +import { afterEach, describe, expect, it, vi } from "vitest"; + +vi.mock("../api/request", () => ({ + requestBlob: vi.fn(async () => new Blob(["img"], { type: "image/png" })), +})); + +import { requestBlob } from "../api/request"; +import { acquireAuthImageSrc, releaseAuthImageSrc } from "./useAuthImageSrc"; + +afterEach(() => { + vi.mocked(requestBlob).mockClear(); +}); + +describe("auth image cache", () => { + it("keeps an idle object URL so the next mount does not refetch", async () => { + const created: string[] = []; + const revoked: string[] = []; + vi.stubGlobal("URL", { + createObjectURL: (blob: Blob) => { + const url = `blob:${created.length}:${blob.size}`; + created.push(url); + return url; + }, + revokeObjectURL: (url: string) => { + revoked.push(url); + }, + }); + + const first = await acquireAuthImageSrc("/api/avatar/keep"); + releaseAuthImageSrc("/api/avatar/keep"); + const second = await acquireAuthImageSrc("/api/avatar/keep"); + releaseAuthImageSrc("/api/avatar/keep"); + + expect(second).toBe(first); + expect(requestBlob).toHaveBeenCalledTimes(1); + expect(revoked).not.toContain(first); + }); +}); diff --git a/dashboard/src/hooks/useAuthImageSrc.ts b/dashboard/src/hooks/useAuthImageSrc.ts index 26a39224fe..27127987c5 100644 --- a/dashboard/src/hooks/useAuthImageSrc.ts +++ b/dashboard/src/hooks/useAuthImageSrc.ts @@ -16,8 +16,29 @@ type AuthImageCacheEntry = { inflight?: Promise; }; +const AUTH_IMAGE_CACHE_LIMIT = 32; const authImageCache = new Map(); +function touchAuthImage(key: string, entry: AuthImageCacheEntry): void { + authImageCache.delete(key); + authImageCache.set(key, entry); +} + +function evictIdleAuthImages(): void { + let idle = 0; + for (const entry of authImageCache.values()) { + if (entry.refs <= 0 && !entry.inflight) idle += 1; + } + if (idle <= AUTH_IMAGE_CACHE_LIMIT) return; + for (const [key, entry] of authImageCache) { + if (idle <= AUTH_IMAGE_CACHE_LIMIT) break; + if (entry.refs > 0 || entry.inflight) continue; + if (entry.objectUrl) URL.revokeObjectURL(entry.objectUrl); + authImageCache.delete(key); + idle -= 1; + } +} + function apiPathFromUrl(url: string): string { if (url.startsWith("http")) { const parsed = new URL(url); @@ -54,6 +75,7 @@ export function acquireAuthImageSrc( } entry.refs += 1; if (entry.objectUrl) { + touchAuthImage(key, entry); return Promise.resolve(entry.objectUrl); } if (!entry.inflight) { @@ -63,10 +85,8 @@ export function acquireAuthImageSrc( const objectUrl = URL.createObjectURL(blob); pending.objectUrl = objectUrl; pending.inflight = undefined; - if (pending.refs <= 0) { - URL.revokeObjectURL(objectUrl); - authImageCache.delete(key); - } + touchAuthImage(key, pending); + evictIdleAuthImages(); return objectUrl; }) .catch((err: unknown) => { @@ -89,10 +109,8 @@ export function releaseAuthImageSrc(url: string, filename?: string): void { if (!entry) return; entry.refs -= 1; if (entry.refs > 0 || entry.inflight) return; - if (entry.objectUrl) { - URL.revokeObjectURL(entry.objectUrl); - } - authImageCache.delete(key); + touchAuthImage(key, entry); + evictIdleAuthImages(); } function releaseHeld(held: HeldAuthImage | undefined): void { diff --git a/dashboard/src/layouts/MainLayout/index.tsx b/dashboard/src/layouts/MainLayout/index.tsx index 6ade910924..b680a5b17b 100644 --- a/dashboard/src/layouts/MainLayout/index.tsx +++ b/dashboard/src/layouts/MainLayout/index.tsx @@ -7,7 +7,6 @@ import RailEdgeControl from "../../components/RailEdgeControl"; import PageLoading from "../../components/PageLoading"; import { ServiceRestartProvider } from "../../context/ServiceRestartContext"; import { BackupOperationProvider } from "../../context/BackupOperationContext"; -import PwaUpdatePrompt from "../../components/PwaUpdatePrompt"; import { PwaAutoPrompt } from "../../components/PwaInstallPrompt"; import { routeConfigs, @@ -303,7 +302,6 @@ export default function MainLayout() { minHeight: 0, }} > - {workbenchMounted && ( diff --git a/dashboard/src/locales/en.json b/dashboard/src/locales/en.json index 6e55a88754..ea22be2fee 100644 --- a/dashboard/src/locales/en.json +++ b/dashboard/src/locales/en.json @@ -111,6 +111,7 @@ "BACKUP_DRIVER_MISMATCH": "This backup was made with a different database engine (SQLite vs PostgreSQL). Switch the runtime to match the backup, or create a new backup on the current engine. Cross-engine restore is not supported.", "BACKUP_SCHEMA_INCOMPATIBLE": "This backup uses database schema version {{archive_schema_version}}, which cannot be restored by this Octop version (maximum supported: {{runtime_schema_version}}).", "BACKUP_IN_PROGRESS": "A backup or restore is already in progress. Try again shortly.", + "BACKUP_CLIENT_MISSING": "PostgreSQL backup needs {{tool}}, which is not installed. Install the PostgreSQL client tools where Octop runs, then try again.", "FORBIDDEN": "Permission denied.", "UPDATE_TARGET_NOT_NEWER": "Target version {{target}} must be newer than installed version {{current}}. Reinstalling or downgrading is not supported.", "NOT_FOUND": "Not found.", @@ -131,6 +132,7 @@ "AGENT_NOT_RUNNING": "This expert is not enabled.", "CHECKPOINT_DELETE_FAILED": "Conversation data was not deleted. The thread is still here; try again.", "THREAD_TURN_ACTIVE": "A reply is still in progress. Stop it, then delete this conversation.", + "THREAD_CONTRIBUTE_REQUIRES_SHARE": "Only a shared expert can share a conversation with other users.", "AGENT_FAILED": "Agent failed to start.", "AGENT_BUSY": "Agent is busy.", "AGENT_NAME_TAKEN": "This name is already in use. Please choose another.", @@ -170,6 +172,8 @@ "BRIDGE_CONNECTION_LIMIT": "At most {{limit}} cloud collab connections per user. Delete one to add another.", "BRIDGE_SELF_CONNECT": "Cannot add this Octop instance as a peer of itself.", "BRIDGE_INBOUND_PASSIVE": "This link was opened by the peer. This side cannot change the address or dial out. After disconnect, the peer must reopen it.", + "BRIDGE_PEER_FORBIDDEN": "The account you signed in with on the peer does not have Cloud collab permission. This is not limited to admins — grant that account Cloud collab on the peer, or sign in with an account that already has it.", + "BRIDGE_PEER_CONNECTION_OWNED": "The peer already registered this cloud collab link to another user, so this account cannot take it over. Ask that user to delete it, or sign in with the same peer account. If the address actually points at this Octop, use the peer's real address instead.", "CRON_TRIGGER_INVALID": "Invalid cron trigger.", "CRON_ALREADY_RUNNING": "This task is already running on another instance.", "SLASH_UNKNOWN": "Unknown slash command.", @@ -998,6 +1002,8 @@ "marketScenePrev": "Scroll left", "marketSceneNext": "Scroll right", "sceneAll": "All", + "sceneFeatured": "Featured", + "featuredHint": "Expert templates that shipped with Octop before the expert market", "scenes": { "academic": "Academic", "content-creation": "Content Creation", @@ -1592,6 +1598,12 @@ "expandMore": "Show more", "pin": "Pin", "unpin": "Unpin", + "contribute": "Share conversation", + "uncontribute": "Stop sharing", + "sharedSession": "Shared", + "sharedSessionBanner": "This conversation is shared. Anyone who can open this expert can read it and continue.", + "threadSettingsOwnerOnly": "Only the conversation owner can change the model and approval settings", + "shareFailed": "Couldn't change sharing. Try again.", "deleteSessionConfirm": "Delete this conversation? This cannot be undone.", "deleteSessionTitle": "Delete this conversation?", "deleteSessionBody": "This cannot be undone. The conversation leaves the list immediately. The database file does not get smaller until it is compacted.", @@ -3295,7 +3307,7 @@ "providersTitle": "Providers", "providersDescription": "Configure API keys and endpoints for each provider.", "llmTitle": "LLM", - "llmDescription": "The system intelligently selects the best model based on message content. You can also set a preferred model.", + "llmDescription": "The system intelligently selects the best model based on message content. You can also set a priority model.", "configureProvider": "Configure {{name}}", "baseURL": "Base URL", "docs": "Docs", @@ -3504,14 +3516,17 @@ "costOutput": "Output Cost (per 1M tokens)", "templateApplied": "✓ Pre-filled from preset template. You can edit these values.", "modelPool": "Available Model Pool", - "autoRouteTooltip": "Auto mode prioritizes your preferred model and switches when the input type is incompatible", - "autoRouteDesc": "These models are currently available. Auto mode prioritizes your preferred model; if a message contains images or other content the current model cannot handle, the system switches to a compatible model.", + "autoRouteTooltip": "Auto mode uses your priority model first and switches when the input type is incompatible", + "autoRouteDesc": "These models are currently available. Auto mode uses your priority model first; if a message contains images or other content the current model cannot handle, the system switches to a compatible model.", "modelCount": "{{count}} available", "modelUnit": "models", "noModelsAvailable": "No models available. Please authorize at least one provider and configure models.", - "preferredModelSet": "{{model}} set as preferred model", - "setAsPreferred": "Set as preferred", - "currentPreferred": "Current preferred model", + "preferredModelSet": "{{model}} set as the priority model", + "preferredModelCleared": "Priority model cleared", + "setAsPreferred": "Use this model first for auto routing", + "clearPreferred": "Clear priority model", + "preferredBadge": "Priority", + "currentPreferred": "Current priority model", "capReasoning": "Reasoning", "cap_text": "Text", "cap_image": "Image", diff --git a/dashboard/src/locales/zh.json b/dashboard/src/locales/zh.json index 74e95645b8..ed091ca3b6 100644 --- a/dashboard/src/locales/zh.json +++ b/dashboard/src/locales/zh.json @@ -111,6 +111,7 @@ "BACKUP_DRIVER_MISMATCH": "该备份与当前数据库引擎不一致(SQLite 与 PostgreSQL 不能互恢)。请将运行时切回备份所用引擎后再恢复,或在当前引擎上重新备份。暂不支持跨引擎恢复。", "BACKUP_SCHEMA_INCOMPATIBLE": "该备份使用数据库结构版本 {{archive_schema_version}},当前 Octop 版本无法恢复(最高支持版本:{{runtime_schema_version}})。", "BACKUP_IN_PROGRESS": "已有备份或恢复任务正在进行,请稍后再试。", + "BACKUP_CLIENT_MISSING": "当前环境找不到 {{tool}},无法备份或恢复 PostgreSQL。请在运行 Octop 的环境中安装 PostgreSQL 客户端后再试。", "FORBIDDEN": "没有权限。", "UPDATE_TARGET_NOT_NEWER": "目标版本 {{target}} 必须高于已安装版本 {{current}},不支持重装同版本或降级。", "NOT_FOUND": "未找到。", @@ -131,6 +132,7 @@ "AGENT_NOT_RUNNING": "此专家未启用。", "CHECKPOINT_DELETE_FAILED": "对话数据没有删除,会话已保留,请重试。", "THREAD_TURN_ACTIVE": "回复进行中,请先停止再删除。", + "THREAD_CONTRIBUTE_REQUIRES_SHARE": "只有共享专家上的会话可以共享给其他用户。", "AGENT_FAILED": "专家启动失败。", "AGENT_BUSY": "专家正忙。", "AGENT_NAME_TAKEN": "该名称已被使用,请换一个名称。", @@ -170,6 +172,8 @@ "BRIDGE_CONNECTION_LIMIT": "每用户最多 {{limit}} 条云端协同,请先删除不用的连接。", "BRIDGE_SELF_CONNECT": "不能把本机 Octop 添加为自己的对端。", "BRIDGE_INBOUND_PASSIVE": "这是对端主动接入的连接,本侧无法改地址或主动拨号。断开后需对端重新打开。", + "BRIDGE_PEER_FORBIDDEN": "对端登录账号没有「云端协同」权限。这项功能不限于管理员:请在对端为该账号打开云端协同权限,或改用已有该权限的账号。", + "BRIDGE_PEER_CONNECTION_OWNED": "对端已把这条云端协同登记在另一个用户名下,当前账号无法接管。请让原用户删除那条连接,或改用同一个对端账号。如果填写的地址其实指向本机,请改成对端的真实地址。", "CRON_TRIGGER_INVALID": "无效的定时触发器。", "CRON_ALREADY_RUNNING": "该任务已在其他实例上运行。", "SLASH_UNKNOWN": "未知的斜杠指令。", @@ -271,7 +275,7 @@ "bridge": "云端协同", "acp": "ACP 协作", "agents": "专家", - "providers": "Providers", + "providers": "供应商", "models": "模型配置", "channels": "通道", "sessions": "会话", @@ -702,7 +706,7 @@ "found": "检测到 OpenClaw 配置", "foundHint": "请选择要迁移的内容,点击「立即迁移」自动同步:", "selectAll": "全选", - "itemModels": "大模型配置(providers + 活跃模型)", + "itemModels": "大模型配置(供应商 + 活跃模型)", "itemChannels": "通道配置(Feishu / DingTalk / QQ / Discord)", "itemModelsOnly": "大模型配置", "itemChannelsOnly": "通道配置", @@ -843,7 +847,7 @@ "ESFP": "表演者" }, "experts": { - "subtitle": "基于已配置的场景模板,一键创建预置身份/灵魂/心跳的智能体。每个专家自带 system prompt,新建后再绑定 provider 并启动即可。", + "subtitle": "基于已配置的场景模板,一键创建预置身份/灵魂/心跳的智能体。每个专家自带 system prompt,新建后再绑定供应商并启动即可。", "loadFailed": "加载专家失败", "loadDetailFailed": "加载详情失败", "share": { @@ -898,7 +902,7 @@ "createWithExpertTitle": "用 {{name}} 创建专家", "agentNameLabel": "专家名称", "pleaseEnterName": "请输入名称", - "afterCreateHint": "创建后请前往专家页绑定 provider 并启动。", + "afterCreateHint": "创建后请前往专家页绑定供应商并启动。", "agentCreated": "已创建专家:{{name}}", "createFailed": "创建失败", "fileLabel": { @@ -998,6 +1002,8 @@ "marketScenePrev": "向左滚动", "marketSceneNext": "向右滚动", "sceneAll": "全部", + "sceneFeatured": "精选", + "featuredHint": "接入专家市场之前,随 Octop 一起提供的专家模板", "scenes": { "academic": "学术", "content-creation": "内容创作", @@ -1061,7 +1067,7 @@ "avatarUploadLater": "专家已创建,头像未能上传,可稍后在编辑专家中添加。", "customColor": "自定义颜色", "defaultModel": "默认模型", - "defaultModelAuto": "Auto(使用 Provider 默认模型)", + "defaultModelAuto": "Auto(使用供应商默认模型)", "editFile": "编辑 →", "editFileTitle": "编辑 {{filename}}", "fileSaved": "{{filename}} 已保存", @@ -1154,7 +1160,7 @@ "shield-check": "安全盾牌", "refresh-cw": "刷新" }, - "noModelsWarning": "当前未配置任何模型,请前往管理员页面配置 Provider。", + "noModelsWarning": "当前未配置任何模型,请前往管理员页面配置供应商。", "goToAdmin": "前往配置", "backendLabel": "存储后端", "backendRootDir": "存储根目录", @@ -1592,6 +1598,12 @@ "expandMore": "展开更多", "pin": "置顶", "unpin": "取消置顶", + "contribute": "共享会话", + "uncontribute": "取消共享", + "sharedSession": "已共享", + "sharedSessionBanner": "这条会话已共享。能打开这个专家的人都能看到,并可以继续问。", + "threadSettingsOwnerOnly": "只有会话创建人可以改模型和审批设置", + "shareFailed": "没能改共享状态,请再试一次", "deleteSessionConfirm": "确定删除这段会话吗?删除后无法恢复。", "deleteSessionTitle": "删除这段会话?", "deleteSessionBody": "删除后无法恢复。会话会马上从列表里消失。数据库文件要等整理之后才会变小。", @@ -3295,7 +3307,7 @@ "providersTitle": "模型提供商", "providersDescription": "为每个模型提供商配置 API 密钥和接入端点。", "llmTitle": "大语言模型", - "llmDescription": "系统会根据消息内容智能选择最合适的模型,您也可以设置偏好模型。", + "llmDescription": "系统会根据消息内容智能选择最合适的模型,您也可以设置优先模型。", "configureProvider": "配置 {{name}}", "baseURL": "接入地址", "docs": "文档", @@ -3318,10 +3330,10 @@ "authHeaderExtra": "将 Authorization: Bearer 作为额外的默认请求头注入", "thinkingLabel": "思考模式", "thinkingExtra": "启用深度思考(思维链)能力。关闭后,该服务商下所有模型将禁用思考模式。", - "providerHeaders": "Provider Headers", + "providerHeaders": "供应商请求头", "headersFormatHint": "每行一个请求头,格式:Key: Value", "requestHeaders": "Request Headers", - "requestHeadersExtra": "优先级高于 Provider Headers", + "requestHeadersExtra": "优先级高于供应商请求头", "apiProtocolLabel": "协议类型", "apiProtocolExtra": "选择与目标 API 兼容的协议类型", "apiProtocolDefault": "默认(OpenAI 兼容)", @@ -3504,14 +3516,17 @@ "costOutput": "输出费用(每百万 Token)", "templateApplied": "✓ 已从预置模板预填充,您可以修改这些值。", "modelPool": "可用模型池", - "autoRouteTooltip": "自动模式优先使用你的偏好模型;当输入类型不兼容时,系统会切换到支持该输入的模型", - "autoRouteDesc": "以下为当前可用模型。自动模式会优先使用你的偏好模型;当消息包含图片等当前模型不支持的内容时,系统会自动切换到兼容模型。", + "autoRouteTooltip": "自动模式优先使用你的优先模型;当输入类型不兼容时,系统会切换到支持该输入的模型", + "autoRouteDesc": "以下为当前可用模型。自动模式会优先使用你的优先模型;当消息包含图片等当前模型不支持的内容时,系统会自动切换到兼容模型。", "modelCount": "{{count}} 个可用", "modelUnit": "个", "noModelsAvailable": "暂无可用模型,请先授权至少一个提供商并配置模型。", - "preferredModelSet": "已将 {{model}} 设为偏好模型", - "setAsPreferred": "设为偏好模型", - "currentPreferred": "当前偏好模型", + "preferredModelSet": "已将 {{model}} 设为优先模型", + "preferredModelCleared": "已取消优先模型", + "setAsPreferred": "设为自动调度的优先模型", + "clearPreferred": "取消优先模型", + "preferredBadge": "当前优先", + "currentPreferred": "当前优先模型", "capReasoning": "推理", "cap_text": "文本", "cap_image": "图像", @@ -3664,7 +3679,7 @@ "decisionFallback": "分数不够、或服务没有返回结果时,这一轮仍使用原来的技能、工具和成员名单。", "addCustomProvider": "自定义供应商", "loadingProviders": "加载中...", - "noProvidersHint": "还没有 provider,点击右上角新建", + "noProvidersHint": "还没有供应商,点击右上角新建", "kindLabel": "类型", "kindOpenaiCompat": "OpenAI 兼容", "pleaseSelectKind": "请选择类型", @@ -3687,27 +3702,27 @@ "testPingHint": "使用已保存配置发送一次 ping。", "testDraftNeedModel": "请至少添加或选择一个模型后再测试。", "codexOAuthLogin": "使用 ChatGPT 登录", - "codexOAuthHint": "通过 ChatGPT 订阅 OAuth 登录,无需手动填写 API Key。登录成功后会自动创建 openai-codex provider。", - "codexOAuthSuccess": "ChatGPT 登录成功,模型 provider 已配置。", + "codexOAuthHint": "通过 ChatGPT 订阅 OAuth 登录,无需手动填写 API Key。登录成功后会自动创建 openai-codex 供应商。", + "codexOAuthSuccess": "ChatGPT 登录成功,模型供应商已配置。", "codexOAuthFailed": "ChatGPT 登录失败:{{error}}", "codexOAuthStartFailed": "无法启动 ChatGPT OAuth", "codexOAuthDisclaimer": "此方式使用 ChatGPT 内部 Codex API,非 OpenAI 官方 API Key 路径,可能受 OpenAI 服务条款与稳定性影响,请自行评估风险。", "codexOAuthDeviceHint": "已在新标签页打开验证页面。如未自动打开,请点击下方按钮,输入下面的验证码完成登录,本页会自动更新。", "codexOAuthOpenVerification": "打开验证页面", "codexOAuthWaiting": "等待您完成授权…", - "cannotDeleteSharedTitle": "无法删除共享 provider", - "cannotDeleteSharedDesc": "此 provider 由管理员维护(user_id 为空),仅管理员可删除。", - "deleteProviderTitle": "删除 provider", + "cannotDeleteSharedTitle": "无法删除共享供应商", + "cannotDeleteSharedDesc": "此供应商由管理员维护(user_id 为空),仅管理员可删除。", + "deleteProviderTitle": "删除供应商", "deleteProviderConfirmSimple": "确认删除 “{{name}}”?该操作不可撤销。", "providerDeletedSimple": "已删除 {{name}}", "toggleStateFailed": "状态切换失败", - "providerCreatedSimple": "已创建 provider “{{name}}”", + "providerCreatedSimple": "已创建供应商 “{{name}}”", "createFailedSimple": "创建失败", "revokeFailedSimple": "撤销失败", "configureProviderTitle": "配置 {{name}}", "providerConfigSaved": "{{name}} 配置已保存", "revokeConfirmTitle": "撤销授权", - "revokeConfirmContentSimple": "确认清除 {{name}} 的 API Key?清除后该 provider 将变为未授权状态。", + "revokeConfirmContentSimple": "确认清除 {{name}} 的 API Key?清除后该供应商将变为未授权状态。", "authorizationRevokedSimpleAlt": "{{name}} 授权已撤销", "testConnectionSuccess": "{{name}} 连接成功{{latency}}", "testConnectionLatency": ",响应 {{time}}ms", @@ -3721,7 +3736,7 @@ "chooseSiteFirst": "请先选择站点", "addSiteVariant": "添加其他站点", "configured": "已配置", - "presetNameExists": "已有同名 provider,请直接编辑", + "presetNameExists": "已有同名供应商,请直接编辑", "sharedProviders": "共享提供商(管理员)", "pleaseEnterApiKey": "请输入 API Key", "fetchModels": "获取模型列表", @@ -5577,10 +5592,10 @@ }, "admin": { "sharedModels": { - "addProvider": "新增共享 Provider", - "deleteConfirm": "确定要删除共享 Provider「{{name}}」?所有用户将无法再使用此 Provider。", - "deleteSuccess": "已删除共享 Provider「{{name}}」", - "createSuccess": "共享 Provider「{{name}}」已创建", + "addProvider": "新增共享供应商", + "deleteConfirm": "确定要删除共享供应商「{{name}}」?所有用户将无法再使用此供应商。", + "deleteSuccess": "已删除共享供应商「{{name}}」", + "createSuccess": "共享供应商「{{name}}」已创建", "createFailed": "创建失败" } }, @@ -7344,7 +7359,7 @@ "WEBAUTHN_CONFIG_INVALID": "还不能使用通行密钥。请管理员在「应用设置 → 通行密钥」填写本站域名和完整网址。如果已经填过,请改用登记的那个网址打开。用 localhost 打开则不用填。" }, "adminProviders": { - "title": "Providers", + "title": "供应商", "newProvider": "新建提供商", "pageDescription": "所有提供商均由管理员统一管理,对每个专家全局可用。", "colName": "名称", diff --git a/dashboard/src/pages/Admin/SharedModels/index.tsx b/dashboard/src/pages/Admin/SharedModels/index.tsx index a97ebffa17..c7f785eb61 100644 --- a/dashboard/src/pages/Admin/SharedModels/index.tsx +++ b/dashboard/src/pages/Admin/SharedModels/index.tsx @@ -26,7 +26,7 @@ export default function AdminSharedModelsPage() { } setProviders(rows); } catch (err) { - setError(err instanceof Error ? err.message : "加载共享 Provider 失败"); + setError(err instanceof Error ? err.message : "加载共享供应商失败"); } finally { setLoading(false); } diff --git a/dashboard/src/pages/Agent/ACP/components/ACPCard.tsx b/dashboard/src/pages/Agent/ACP/components/ACPCard.tsx index 5fe2edddab..09665cdc94 100644 --- a/dashboard/src/pages/Agent/ACP/components/ACPCard.tsx +++ b/dashboard/src/pages/Agent/ACP/components/ACPCard.tsx @@ -3,7 +3,12 @@ import { CheckCircle, Plug } from "lucide-react"; import { useTranslation } from "react-i18next"; import cx from "classnames"; import type { ACPRunnerConfig } from "../../../../api/types/acp"; -import { runnerIcon, runnerIntroKey, runnerLabelKey } from "../constants"; +import { + isBuiltinRunner, + runnerIcon, + runnerIntroKey, + runnerLabelKey, +} from "../constants"; import styles from "../../Channels/index.module.less"; import acpStyles from "../index.module.less"; @@ -36,11 +41,11 @@ export function ACPCard({ onToggleEnabled, }: ACPCardProps) { const { t } = useTranslation(); - const labelKey = runnerLabelKey(runnerKey); - const label = labelKey ? t(labelKey) : runnerKey; - const introKey = runnerIntroKey(runnerKey); - const intro = introKey - ? t(introKey) + const label = isBuiltinRunner(runnerKey) + ? t(runnerLabelKey(runnerKey)) + : runnerKey; + const intro = isBuiltinRunner(runnerKey) + ? t(runnerIntroKey(runnerKey)) : t("acp.intro_custom", { command: config.command || t("acp.notSet"), }); diff --git a/dashboard/src/pages/Agent/Workspace/components/FilePreview.tsx b/dashboard/src/pages/Agent/Workspace/components/FilePreview.tsx index ba63303ca1..d6167f5d22 100644 --- a/dashboard/src/pages/Agent/Workspace/components/FilePreview.tsx +++ b/dashboard/src/pages/Agent/Workspace/components/FilePreview.tsx @@ -2,6 +2,7 @@ import type { RefObject } from "react"; import { useEffect, useRef, useState } from "react"; import Markdown from "../../../../components/Markdown/LazyMarkdown"; import styles from "../index.module.less"; +import { isolateHtmlPreview } from "./htmlPreviewDoc"; /** * Rich preview kinds — documents that benefit from rendered view. @@ -122,7 +123,7 @@ export default function FilePreview({