mirror of
https://github.com/basketikun/infinite-canvas.git
synced 2026-08-05 17:04:27 +08:00
feat: add Codex App plugin support with dedicated configuration page and connection settings
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
+ [新增] 新增Codex App插件支持。
|
+ [新增] 新增Codex App插件支持。
|
||||||
|
+ [新增] 配置与用户偏好新增独立页面和 Codex 连接配置 Tab。
|
||||||
+ [修复] 修复生图工作台重试成功结果刷新后丢失的问题。
|
+ [修复] 修复生图工作台重试成功结果刷新后丢失的问题。
|
||||||
|
|
||||||
## v0.5.0 - 2026-07-05
|
## v0.5.0 - 2026-07-05
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ description: 当前版本已实现但仍需人工验证的变更项
|
|||||||
# 待测试
|
# 待测试
|
||||||
|
|
||||||
- Codex App 插件文档:新增插件安装教程,区分 AI 自动安装、手动安装和本仓库开发调试安装;同步优化插件 README 与技能说明。
|
- Codex App 插件文档:新增插件安装教程,区分 AI 自动安装、手动安装和本仓库开发调试安装;同步优化插件 README 与技能说明。
|
||||||
|
- 顶部导航:缩小桌面顶部导航栏高度,导航项下划线和内容垂直对齐需确认。
|
||||||
|
- 配置与用户偏好:新增独立顶部导航页面,并在页面和弹窗中复用同一套配置面板;新增 Codex Tab,展示插件安装和本地 Agent 启动步骤,可配置本地 Agent 地址、Connect token 和工具执行确认开关。
|
||||||
- 配置与用户偏好:每个模型渠道新增 OpenAI / Gemini 调用格式选择,默认 OpenAI,切换默认格式时同步更新默认 Base URL;渠道 Tab 增加紧凑醒目的提醒,说明模型是否可选需要到“模型”Tab 选择。
|
- 配置与用户偏好:每个模型渠道新增 OpenAI / Gemini 调用格式选择,默认 OpenAI,切换默认格式时同步更新默认 Base URL;渠道 Tab 增加紧凑醒目的提醒,说明模型是否可选需要到“模型”Tab 选择。
|
||||||
- Gemini 调用格式:支持拉取 Gemini 模型列表,并用于文本问答、在线 Agent 工具调用、基础生图和图生图请求。
|
- Gemini 调用格式:支持拉取 Gemini 模型列表,并用于文本问答、在线 Agent 工具调用、基础生图和图生图请求。
|
||||||
- 音频和视频生成:选择 Gemini 调用格式时先给出不支持提示,仍需使用 OpenAI 兼容渠道。
|
- 音频和视频生成:选择 Gemini 调用格式时先给出不支持提示,仍需使用 OpenAI 兼容渠道。
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { App, Button, Form, Input, Modal, Progress, Select, Tabs } from "antd";
|
import { App, Button, Form, Input, Modal, Progress, Select, Switch, Tabs } from "antd";
|
||||||
import { CircleAlert, Cloud, Plus, RefreshCw, Trash2, Wifi } from "lucide-react";
|
import { CircleAlert, Cloud, KeyRound, Link2, Plus, RefreshCw, ShieldCheck, Trash2, Wifi } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
import { ModelPicker } from "@/components/model-picker";
|
import { ModelPicker } from "@/components/model-picker";
|
||||||
@@ -7,6 +7,7 @@ import { fetchChannelModels } from "@/services/api/image";
|
|||||||
import { syncAppDataToWebdav, type AppSyncDomainKey, type AppSyncProgressEvent } from "@/services/app-sync";
|
import { syncAppDataToWebdav, type AppSyncDomainKey, type AppSyncProgressEvent } from "@/services/app-sync";
|
||||||
import { testWebdavConnection, WEBDAV_MANIFEST_FILE_NAME } from "@/services/webdav-sync";
|
import { testWebdavConnection, WEBDAV_MANIFEST_FILE_NAME } from "@/services/webdav-sync";
|
||||||
import { audioFormatOptions, audioVoiceOptions, normalizeAudioSpeedValue } from "@/lib/audio-generation";
|
import { audioFormatOptions, audioVoiceOptions, normalizeAudioSpeedValue } from "@/lib/audio-generation";
|
||||||
|
import { useCanvasAgentStore } from "@/stores/canvas/use-canvas-agent-store";
|
||||||
import { createModelChannel, defaultBaseUrlForApiFormat, filterModelsByCapability, modelOptionLabel, modelOptionsFromChannels, normalizeModelOptionValue, useConfigStore, type AiConfig, type ApiCallFormat, type ModelCapability, type ModelChannel } from "@/stores/use-config-store";
|
import { createModelChannel, defaultBaseUrlForApiFormat, filterModelsByCapability, modelOptionLabel, modelOptionsFromChannels, normalizeModelOptionValue, useConfigStore, type AiConfig, type ApiCallFormat, type ModelCapability, type ModelChannel } from "@/stores/use-config-store";
|
||||||
|
|
||||||
type ModelGroup = {
|
type ModelGroup = {
|
||||||
@@ -44,6 +45,11 @@ const webdavDomainLabels: Record<AppSyncDomainKey, string> = {
|
|||||||
"image-workbench": "生图工作台",
|
"image-workbench": "生图工作台",
|
||||||
"video-workbench": "视频创作台",
|
"video-workbench": "视频创作台",
|
||||||
};
|
};
|
||||||
|
const codexSetupSteps = [
|
||||||
|
{ title: "安装 Codex 插件", text: "先在 Codex App 安装 Infinite Canvas 插件,插件会注册 MCP 并尝试启动本地 Canvas Agent。" },
|
||||||
|
{ title: "打开画布 Agent", text: "回到画布右侧 Agent 面板选择本地模式,网页会自动读取 Local URL 和 Connect token。" },
|
||||||
|
{ title: "手动启动备用", text: "如果插件没有自动启动本地服务,在终端运行下面命令。", command: "npx -y @basketikun/canvas-agent" },
|
||||||
|
];
|
||||||
|
|
||||||
function createWebdavDomainProgress(): Record<AppSyncDomainKey, WebdavDomainProgress> {
|
function createWebdavDomainProgress(): Record<AppSyncDomainKey, WebdavDomainProgress> {
|
||||||
return webdavDomainKeys.reduce(
|
return webdavDomainKeys.reduce(
|
||||||
@@ -55,7 +61,7 @@ function createWebdavDomainProgress(): Record<AppSyncDomainKey, WebdavDomainProg
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AppConfigModal() {
|
export function AppConfigPanel({ showDoneButton = false }: { showDoneButton?: boolean }) {
|
||||||
const { message } = App.useApp();
|
const { message } = App.useApp();
|
||||||
const [activeTab, setActiveTab] = useState("channels");
|
const [activeTab, setActiveTab] = useState("channels");
|
||||||
const [loadingChannelId, setLoadingChannelId] = useState("");
|
const [loadingChannelId, setLoadingChannelId] = useState("");
|
||||||
@@ -67,10 +73,16 @@ export function AppConfigModal() {
|
|||||||
const webdav = useConfigStore((state) => state.webdav);
|
const webdav = useConfigStore((state) => state.webdav);
|
||||||
const updateConfig = useConfigStore((state) => state.updateConfig);
|
const updateConfig = useConfigStore((state) => state.updateConfig);
|
||||||
const updateWebdavConfig = useConfigStore((state) => state.updateWebdavConfig);
|
const updateWebdavConfig = useConfigStore((state) => state.updateWebdavConfig);
|
||||||
const isConfigOpen = useConfigStore((state) => state.isConfigOpen);
|
|
||||||
const shouldPromptContinue = useConfigStore((state) => state.shouldPromptContinue);
|
const shouldPromptContinue = useConfigStore((state) => state.shouldPromptContinue);
|
||||||
const setConfigDialogOpen = useConfigStore((state) => state.setConfigDialogOpen);
|
const setConfigDialogOpen = useConfigStore((state) => state.setConfigDialogOpen);
|
||||||
const clearPromptContinue = useConfigStore((state) => state.clearPromptContinue);
|
const clearPromptContinue = useConfigStore((state) => state.clearPromptContinue);
|
||||||
|
const agentUrl = useCanvasAgentStore((state) => state.url);
|
||||||
|
const agentToken = useCanvasAgentStore((state) => state.token);
|
||||||
|
const agentConnected = useCanvasAgentStore((state) => state.connected);
|
||||||
|
const agentEnabled = useCanvasAgentStore((state) => state.enabled);
|
||||||
|
const agentActivity = useCanvasAgentStore((state) => state.activity);
|
||||||
|
const agentConfirmTools = useCanvasAgentStore((state) => state.confirmTools);
|
||||||
|
const setAgentState = useCanvasAgentStore((state) => state.setAgentState);
|
||||||
const modelOptions = config.models.map((model) => ({ label: modelOptionLabel(config, model), value: model }));
|
const modelOptions = config.models.map((model) => ({ label: modelOptionLabel(config, model), value: model }));
|
||||||
const webdavReady = Boolean(webdav.url.trim());
|
const webdavReady = Boolean(webdav.url.trim());
|
||||||
|
|
||||||
@@ -205,25 +217,14 @@ export function AppConfigModal() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateAgentConfig = (patch: { url?: string; token?: string }) => {
|
||||||
|
setAgentState(patch);
|
||||||
|
if (patch.url !== undefined) localStorage.setItem("canvas-agent-url", patch.url.trim().replace(/\/$/, ""));
|
||||||
|
if (patch.token !== undefined) localStorage.setItem("canvas-agent-token", patch.token);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<>
|
||||||
title={
|
|
||||||
<div>
|
|
||||||
<div className="text-lg font-semibold">配置与用户偏好</div>
|
|
||||||
<div className="mt-1 text-xs font-normal text-stone-500">渠道聚合、模型选择和同步偏好</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
open={isConfigOpen}
|
|
||||||
width={980}
|
|
||||||
centered
|
|
||||||
onCancel={() => setConfigDialogOpen(false)}
|
|
||||||
styles={{ body: { maxHeight: "72vh", overflowY: "auto", paddingRight: 12 } }}
|
|
||||||
footer={
|
|
||||||
<Button type="primary" onClick={finishConfig}>
|
|
||||||
完成
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Tabs
|
<Tabs
|
||||||
activeKey={activeTab}
|
activeKey={activeTab}
|
||||||
onChange={setActiveTab}
|
onChange={setActiveTab}
|
||||||
@@ -415,8 +416,86 @@ export function AppConfigModal() {
|
|||||||
</Form>
|
</Form>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "codex",
|
||||||
|
label: "Codex",
|
||||||
|
children: (
|
||||||
|
<Form layout="vertical" requiredMark={false}>
|
||||||
|
<section className="rounded-lg border border-stone-200 p-3 dark:border-stone-800">
|
||||||
|
<div className="mb-3 flex flex-wrap items-start justify-between gap-3">
|
||||||
|
<div>
|
||||||
|
<div className="flex items-center gap-2 text-sm font-semibold">
|
||||||
|
<Link2 className="size-4" />
|
||||||
|
连接本地 Codex
|
||||||
|
</div>
|
||||||
|
<div className="mt-1 text-xs text-stone-500">用于画布 Agent 连接本机 Codex 插件启动的 Canvas Agent。</div>
|
||||||
|
</div>
|
||||||
|
<div className="text-xs text-stone-500">{agentConnected ? agentActivity || "已连接" : agentEnabled ? "连接中" : "未连接"}</div>
|
||||||
|
</div>
|
||||||
|
<div className="mb-4 grid gap-2 md:grid-cols-3">
|
||||||
|
{codexSetupSteps.map((step, index) => (
|
||||||
|
<div key={step.title} className="rounded-md border border-stone-200 p-3 dark:border-stone-800">
|
||||||
|
<div className="text-xs font-semibold text-stone-500">步骤 {index + 1}</div>
|
||||||
|
<div className="mt-1 text-sm font-medium">{step.title}</div>
|
||||||
|
<div className="mt-1 text-xs leading-5 text-stone-500">{step.text}</div>
|
||||||
|
{step.command ? <code className="mt-2 block overflow-x-auto rounded bg-stone-100 px-2 py-1.5 text-[11px] text-stone-700 dark:bg-stone-900 dark:text-stone-200">{step.command}</code> : null}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className="grid gap-4 md:grid-cols-2">
|
||||||
|
<Form.Item label="Local URL" className="mb-4">
|
||||||
|
<Input prefix={<Link2 className="mr-1 size-4 text-stone-400" />} value={agentUrl} placeholder="http://127.0.0.1:17371" onChange={(event) => updateAgentConfig({ url: event.target.value })} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="Connect token" className="mb-4">
|
||||||
|
<Input.Password prefix={<KeyRound className="mr-1 size-4 text-stone-400" />} value={agentToken} placeholder="自动发现,或手动填入 Connect token" onChange={(event) => updateAgentConfig({ token: event.target.value })} />
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-wrap items-center justify-between gap-3 rounded-md border border-stone-200 px-3 py-2 dark:border-stone-800">
|
||||||
|
<div className="flex min-w-0 items-center gap-2">
|
||||||
|
<ShieldCheck className="size-4 text-stone-500" />
|
||||||
|
<div>
|
||||||
|
<div className="text-sm font-medium">执行画布操作前确认</div>
|
||||||
|
<div className="mt-0.5 text-xs text-stone-500">关闭后,本地 Codex 可直接执行画布工具调用。</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Switch checked={agentConfirmTools} onChange={(confirmTools) => setAgentState({ confirmTools })} />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</Form>
|
||||||
|
),
|
||||||
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
{showDoneButton ? (
|
||||||
|
<div className="mt-4 flex justify-end">
|
||||||
|
<Button type="primary" onClick={finishConfig}>
|
||||||
|
完成
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AppConfigModal() {
|
||||||
|
const isConfigOpen = useConfigStore((state) => state.isConfigOpen);
|
||||||
|
const setConfigDialogOpen = useConfigStore((state) => state.setConfigDialogOpen);
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title={
|
||||||
|
<div>
|
||||||
|
<div className="text-lg font-semibold">配置与用户偏好</div>
|
||||||
|
<div className="mt-1 text-xs font-normal text-stone-500">渠道聚合、模型选择和同步偏好</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
open={isConfigOpen}
|
||||||
|
width={980}
|
||||||
|
centered
|
||||||
|
onCancel={() => setConfigDialogOpen(false)}
|
||||||
|
styles={{ body: { maxHeight: "72vh", overflowY: "auto", paddingRight: 12 } }}
|
||||||
|
footer={null}
|
||||||
|
>
|
||||||
|
<AppConfigPanel showDoneButton />
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export function AppTopNav() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!hideHeader ? (
|
{!hideHeader ? (
|
||||||
<header className="sticky top-0 z-20 h-16 shrink-0 border-b border-stone-200 bg-background/90 backdrop-blur-xl dark:border-stone-800">
|
<header className="sticky top-0 z-20 h-14 shrink-0 border-b border-stone-200 bg-background/90 backdrop-blur-xl dark:border-stone-800">
|
||||||
<div className="mx-auto flex h-full max-w-7xl items-stretch justify-between gap-5 px-6">
|
<div className="mx-auto flex h-full max-w-7xl items-stretch justify-between gap-5 px-6">
|
||||||
<div className="flex min-w-0 items-center">
|
<div className="flex min-w-0 items-center">
|
||||||
<Link to="/" className="flex h-full shrink-0 items-center gap-2 text-sm font-semibold leading-none tracking-tight text-stone-950 transition hover:text-stone-600 dark:text-stone-100 dark:hover:text-stone-300">
|
<Link to="/" className="flex h-full shrink-0 items-center gap-2 text-sm font-semibold leading-none tracking-tight text-stone-950 transition hover:text-stone-600 dark:text-stone-100 dark:hover:text-stone-300">
|
||||||
@@ -42,7 +42,7 @@ export function AppTopNav() {
|
|||||||
<Menu className="size-5" />
|
<Menu className="size-5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<nav className="hide-scrollbar ml-8 hidden h-16 min-w-0 items-center gap-7 overflow-x-auto md:flex">
|
<nav className="hide-scrollbar ml-8 hidden h-14 min-w-0 items-center gap-7 overflow-x-auto md:flex">
|
||||||
{navigationTools.map((tool) => {
|
{navigationTools.map((tool) => {
|
||||||
const Icon = tool.icon;
|
const Icon = tool.icon;
|
||||||
const active = tool.slug === activeToolSlug;
|
const active = tool.slug === activeToolSlug;
|
||||||
@@ -51,7 +51,7 @@ export function AppTopNav() {
|
|||||||
key={tool.slug}
|
key={tool.slug}
|
||||||
to={`/${tool.slug}`}
|
to={`/${tool.slug}`}
|
||||||
className={cn(
|
className={cn(
|
||||||
"relative flex h-16 shrink-0 items-center gap-2 text-sm leading-6 transition after:absolute after:inset-x-0 after:bottom-0 after:h-px",
|
"relative flex h-14 shrink-0 items-center gap-2 text-sm leading-6 transition after:absolute after:inset-x-0 after:bottom-0 after:h-px",
|
||||||
active
|
active
|
||||||
? "font-medium text-stone-950 after:bg-stone-950 dark:text-stone-100 dark:after:bg-stone-100"
|
? "font-medium text-stone-950 after:bg-stone-950 dark:text-stone-100 dark:after:bg-stone-100"
|
||||||
: "text-stone-500 after:bg-transparent hover:text-stone-950 dark:text-stone-400 dark:hover:text-stone-100",
|
: "text-stone-500 after:bg-transparent hover:text-stone-950 dark:text-stone-400 dark:hover:text-stone-100",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FileText, ImagePlus, Images, Maximize2, Video } from "lucide-react";
|
import { FileText, ImagePlus, Images, Maximize2, Settings2, Video } from "lucide-react";
|
||||||
|
|
||||||
export const navigationTools = [
|
export const navigationTools = [
|
||||||
{
|
{
|
||||||
@@ -26,6 +26,11 @@ export const navigationTools = [
|
|||||||
label: "我的素材",
|
label: "我的素材",
|
||||||
icon: Images,
|
icon: Images,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
slug: "config",
|
||||||
|
label: "配置",
|
||||||
|
icon: Settings2,
|
||||||
|
},
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type NavigationToolSlug = (typeof navigationTools)[number]["slug"];
|
export type NavigationToolSlug = (typeof navigationTools)[number]["slug"];
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { AppConfigPanel } from "@/components/layout/app-config-modal";
|
||||||
|
|
||||||
|
export default function ConfigPage() {
|
||||||
|
return (
|
||||||
|
<main className="h-full overflow-y-auto bg-background">
|
||||||
|
<div className="mx-auto max-w-6xl px-6 py-6">
|
||||||
|
<div className="mb-5">
|
||||||
|
<h1 className="text-xl font-semibold text-stone-950 dark:text-stone-100">配置与用户偏好</h1>
|
||||||
|
<p className="mt-1 text-sm text-stone-500">渠道聚合、模型选择、同步偏好和 Codex 连接配置</p>
|
||||||
|
</div>
|
||||||
|
<AppConfigPanel />
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import UserLayout from "@/layouts/user-layout";
|
|||||||
import AssetsPage from "@/pages/assets";
|
import AssetsPage from "@/pages/assets";
|
||||||
import CanvasPage from "@/pages/canvas";
|
import CanvasPage from "@/pages/canvas";
|
||||||
import CanvasProjectPage from "@/pages/canvas/project";
|
import CanvasProjectPage from "@/pages/canvas/project";
|
||||||
|
import ConfigPage from "@/pages/config";
|
||||||
import HomePage from "@/pages/home";
|
import HomePage from "@/pages/home";
|
||||||
import ImagePage from "@/pages/image";
|
import ImagePage from "@/pages/image";
|
||||||
import NotFound from "@/pages/not-found";
|
import NotFound from "@/pages/not-found";
|
||||||
@@ -25,6 +26,7 @@ export const router = createBrowserRouter([
|
|||||||
{ path: "/prompts", element: <PromptsPage /> },
|
{ path: "/prompts", element: <PromptsPage /> },
|
||||||
{ path: "/canvas", element: <CanvasPage /> },
|
{ path: "/canvas", element: <CanvasPage /> },
|
||||||
{ path: "/canvas/:id", element: <CanvasProjectPage /> },
|
{ path: "/canvas/:id", element: <CanvasProjectPage /> },
|
||||||
|
{ path: "/config", element: <ConfigPage /> },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ path: "*", element: <NotFound /> },
|
{ path: "*", element: <NotFound /> },
|
||||||
|
|||||||
Reference in New Issue
Block a user