mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-09 19:19:50 +08:00
* fix(chat): close credential leaks and harden the chat route
- Vertex: a client-supplied base URL only works with the client's own Vertex key
- Accept only data: URLs for file parts in every message, so the server never downloads them
- Output budget retry accounts for the thinking budget Bedrock/Anthropic add, and reads
Volcengine, DashScope, SGLang and vLLM rejections; falls back to 16000 once
- x-max-output-tokens can only lower the budget on server credentials
- On server credentials only server models or AI_MODEL entries can be used
- Drop tool results together with the invalid tool calls they belong to
- Count quota tokens as input + output (cached tokens were counted twice)
- Private-URL check for custom base URLs, end Langfuse traces on error/abort/early return
- Fix repairToolCall ordering and placeholder, align edit_diagram prompt with operations
- Panel Bedrock keys are read from ADMIN_AWS_*; forward the access code to EdgeOne
- isMinimalDiagram only treats root cells as an empty canvas
* fix(api): require access codes and limit sizes on helper routes
- Shared checkAccessCode for validate-diagram, validate-model, parse-url, verify-access-code
- parse-url: 5 MB streamed body limit; validate-diagram: 5 MB image limit
- validate-model refuses redirects when private URLs are blocked
- Admin settings state shared across module instances via globalThis
- Server model ids: unique slugs (non-ASCII names encoded), duplicates rejected
- Panel Bedrock credentials stored as ADMIN_AWS_* so the DynamoDB client keeps its own
- Locale redirect keeps basePath and query; EdgeOne function drops open CORS and checks the access code
- Providers payload reports whether .env sets a default model
* fix(chat): keep saved diagrams and pages when restoring, editing and retrying
- Restored sessions no longer replay the last display_diagram over the saved diagram
- Failed or stopped edit_diagram restores the canvas
- Message snapshots keep the full multi-page document
- "Improve with suggestions" uses the normal send path (headers, xml, retry counters)
- Editing a message keeps its file/URL sections; cached example edits work
- New chat's first autosave no longer resets the UI
- Validation retries counted per user turn; validate-diagram sends the access code
- Cached examples only match the example files on an empty canvas
- Template sends keep attachments and wait for extraction
* fix(diagram): fix autosave staleness and XML repair corrupting valid diagrams
- Autosave guard reads refs, so edits after a theme or dark mode switch are kept
- Duplicate-id check and rename run per page; repair loop no longer quadratic
- autoFixXml no longer breaks style values, rich text " or single-line cells
- extractCompleteMxCells keeps the cell after a self-closing cell
- Better truncation detection; object/UserObject wrapped cells are editable
- Exports for thumbnail, PNG and save are routed by tag instead of a shared resolver
- History stores the full document; storage errors are reported, no auto-deletion of chats
- IndexedDB connection reopens after errors; focus refresh throttled
- Keep ?session= on locale redirect, map zh-Hant to zh-tw for draw.io
* fix(chat-input): stop template dialogs from sending and fix attachment races
- Template dialogs no longer submit the outer chat form
- Sending is blocked while files or URLs are still extracting
- File and URL extraction no longer drop or resurrect entries
- IME composition Enter no longer sends
- Tool call cards show the error text; keyboard handling on cards fixed
- Template import available when empty, edit dialog resets, saved templates refresh
- Only png/jpeg/gif/webp images accepted, SVG sent as text; PDF objects released
- parse-url request sends the access code
* fix(model-config): keep model selection valid and fix admin panel edge cases
- Fall back to the default server model when a saved one disappears
- Sync model config across tabs
- Validation uses the base path and sends the access code
- Model ids edited as drafts (no empty, duplicate or padded ids)
- Credential changes reset validation; stale validation results are dropped
- Admin: generateId over HTTP, env-locked group switches, discard and toggle fixes,
clearing a secret field keeps the saved key, first provider not auto-default when .env sets AI_MODEL
- Model selector items use unique values
* fix(electron): decrypt keys after ready and harden navigation and IPC
- Apply preset env after app ready, so Windows/Linux get decrypted keys
- Never re-encrypt ciphertext; restore env when switching or removing presets
- Block navigation away from the app, open external links in the browser, check IPC senders
- Keep inherited proxy settings, default NO_PROXY for localhost
- Serialize server start/restart, kill stuck processes, follow port changes
- Atomic config writes, keep corrupt files as backups, remember the server port
- Menu and settings window stay in sync; dev script gets the decrypted preset env
- Use app.isPackaged, parse inline .env comments, drop .env files from the bundle
* fix(mcp-server): fix XSS and crashes, make XML validation strict
- Validate and escape the mcp session id; only serve localhost Host/Origin
- Malformed URLs and session ids return errors instead of crashing the process
- Strict XML syntax check with saxes (linkedom never reports parse errors)
- autoFixXml no longer corrupts valid XML; attribute newlines serialized as entities
- Sessions stay alive while polled; browser pushes carry a base version (409 on conflict)
- Page tools respect the edit gate; UTF-8 bodies decoded correctly
- Export replies matched to requests and serialized; xml sync export handled
- UserObject/object cells addressable by id; history restored by stable id; logs off stdout
* fix(mcp-server): make edit_diagram all-or-nothing and fix preview sync races
- edit_diagram applies nothing when any operation fails, rejects invalid or
multi-cell new_xml, validates only the target page, and returns the
current page XML on every rejection (including stale edits)
- Fix get_diagram reading the old diagram right after an AI write: the
preview pushed its sync reply with a newer version than it was taken at
- Keep a user edit that loses the race with an AI write in history and
tell the user in the preview
- Autofix removes only exact foreign tags (a stray <mxGraph/> deleted
<mxGraphModel>), fixes tag case, drops orphan <mxPoint>s, and rejects
unknown element names in model XML
- Edit empty and compressed pages; PNG exports use the page on screen;
tag download exports; reload from the server after a page export
- Expand ~ in paths, tell the model when the browser sync timed out,
use registerPrompt, require SDK ^1.31.0
* feat(mcp-server): bring the web app's drawing knowledge to MCP
- Add a drawing guide adapted from the web system prompt (layout, edge
routing, styles, minimal style, editing rules), returned by
start_session, a new get_drawing_guide tool and the diagram-workflow prompt
- Add get_shape_library with the 30 icon libraries; the build copies
docs/shape-libraries into dist and CI checks the packed files
- Accept bare mxCell lists in create_new_diagram and add_page; the server
adds the wrapper and root cells
- Send server instructions, shorten create_new_diagram's description to
fit Claude Code's 2,048 character limit, and annotate every tool
- Fix dead links and the totals in docs/shape-libraries/README.md
* feat(mcp-server): add screenshot_diagram so the model can check its render
- New read-only screenshot_diagram tool returns the rendered page as a PNG
plus the web app's visual checklist (overlaps, edges crossing shapes,
readability, layout, rendering errors), replacing the web app's
separate vision model with the host model's own vision
- PNG exports use draw.io's width and pageId options: screenshots stay
under ~140,000 base64 characters and page exports no longer swap the
page on screen
- Fail fast with a clear message when the preview tab stopped polling
(browsers throttle background tabs)
- Mention the screenshot step in the drawing guide and instructions
* feat(mcp-server): auto-save each session's diagram to a .drawio file
- Save the latest diagram of every session 1 second after each change
(AI write, browser edit, history restore) to ~/.next-ai-drawio/<id>.drawio,
keep the newest 50, flush on shutdown; DRAWIO_DATA_DIR changes the folder
and "off" disables it, like the web app's IndexedDB sessions
- start_session names the file, so a resumed conversation can reopen the
diagram with load_diagram after the MCP process restarted
- Fix PNG/SVG exports randomly timing out: a previous export's 10 second
timer cleared the export in progress, and a late reply could be taken
for the current one; exports are now numbered
* refactor(mcp-server): move the preview page into src/preview
The 580-line page template in http-server.ts becomes index.html,
preview.css and preview.js, copied to dist/preview by the build and
filled at request time. The rendered page is unchanged apart from the
session id and draw.io origin now coming from a small config script.
Biome skips the folder because of the {{placeholders}}, as it never
linted the old template string either.
* feat(mcp-server): add theme menu, dark mode and editable SVG to the preview
- Pass themes=1 and dark=auto to the draw.io iframe, so the Extras menu
offers the Theme submenu and draw.io follows the system dark mode; the
header and dialogs follow it too through prefers-color-scheme
- Download dialog: new Editable SVG (.drawio.svg) format through draw.io's
xmlsvg export, default name diagram-YYYY-MM-DD, Enter saves and Escape
closes it and the history dialog
- export_diagram accepts format "drawio.svg" and detects the .drawio.svg
extension
- Use system fonts instead of Google Fonts, so the page works offline with
a self-hosted draw.io (DRAWIO_BASE_URL)
* docs(mcp-server): describe the new MCP features in all READMEs
- MCP server README: 13 tools, drawing rules and shape libraries,
screenshots, all-or-nothing edits, auto-save and how to continue a
diagram later, DRAWIO_DATA_DIR and DEBUG, offline use with a local
draw.io, and what to do when a background tab makes exports time out
- Fix two errors: History is a button at the top right of the preview
page, and exports are not limited to .drawio
- Claude Code plugin README: same tool list, formats and settings
- Root READMEs (English, Chinese, Japanese): short list of what the MCP
server can do
* fix(mcp-server): fix duplicate page exports and auto-save deleting user files
- Preview page: keep an MCP export open until the server has its result.
A poll answered before that still saw the request and started the same
export again, so a parallel page export could write the previous
page's image into its file
- Auto-save only removes its own mcp-*.drawio files, so a DRAWIO_DATA_DIR
that also holds the user's diagrams keeps them
- screenshot_diagram captures a page that has no id attribute by loading
just that page, like export_diagram
- An empty <Array as="points"/> no longer hides orphan mxPoints that
come after it
- POST /api/state refuses a push without xml, which used to wipe the
stored diagram
- Clear exportOptions when an export ends, reuse hasCells for the empty
diagram check, and reword two log lines
* fix: log Editable SVG saves, use local dates in file names, drop unused Electron dialogs
- /api/log-save accepted only drawio, png and svg, so saving as Editable
SVG (xmlsvg) got a 400 and was never recorded in Langfuse
- The default download name and the template export name used the UTC
date, which is the previous day on mornings in East Asia
- Remove the Electron openFile/saveFile IPC handlers, their preload
bindings and types; nothing in the app calls them
* refactor(mcp-server): make the diagram modules usable from the web app
The web app will reuse the MCP server's XML engine instead of its own
copy in lib/utils.ts, so these modules now run in the browser too.
- Relative imports end in .ts, rewritten to .js by tsc
(rewriteRelativeImportExtensions); Next.js resolves them directly
- Every module uses the global DOMParser/XMLSerializer: native in the
browser, linkedom in Node via installDomPolyfill. pages.ts parsed with
linkedom but serialized with the global serializer, which throws in
the browser
- The saxes syntax check moves to xml-syntax.ts, so the browser does not
pull in linkedom; it now also rejects undeclared prefixes such as
xlink:, as the browser does
- Page decompression uses pako and atob instead of node:zlib and Buffer
- hasCells moves to pages.ts, away from the file system code
- The duplicate cell id check counts UserObject/object ids
- wrapCellsInModel drops comments and text before the first cell, which
the web app accepts today
- validateAndFixXml takes { strict: false } for diagrams with user content
- Web tests run these modules with a browser DOM (jsdom)
- saxes becomes a direct dependency of the web app
* refactor(web): validate and repair diagram XML with the MCP server's engine
- Delete the web app's own copy of the XML checks and repairs from
lib/utils.ts (1,074 lines). loadDiagram now uses the MCP server's
validateAndFixXml without the strict checks, because the XML may hold
the user's own diagram
- display_diagram and append_diagram prepare the model's XML with the new
shared prepareNewDiagram, also used by the MCP create_new_diagram: wrap,
validate strictly and auto-fix while it is still a bare model (where
duplicate ids are renamed), then turn it into an mxfile
- The streaming preview of display_diagram no longer redraws the model's
raw cells after the tool handler loaded the checked diagram, and drops
a queued preview once the input is complete. That redraw lost
auto-fixes and UserObject/object wrappers, so a linked cell lost its
label; it also showed a second error toast
- The web repair regression tests now run against the MCP functions
- New e2e test checks the canvas content after display_diagram
- Fix the e2e upload tests, whose file input locator also matched the
template import input
* refactor(web): edit and wrap diagrams with the MCP server's code
- edit_diagram runs the MCP server's editDiagram: every new_xml is checked
first, one cell per operation, and after the edit only the target page
is checked, rejecting only errors this edit introduced. An unrelated
problem elsewhere in the document no longer blocks every edit. The
error lists each failed operation
- The streaming edit preview uses the MCP applyDiagramOperations
- Delete applyDiagramOperations (292 lines) and wrapWithMxFile from
lib/utils.ts, and the unused hand-copied scripts/test-diagram-operations.mjs
- One blank document (BLANK_MXFILE) for the web app and the MCP preview,
replacing four copies
- Saving a .drawio wraps a bare model with normalizeToMxfile
- The empty-diagram check uses hasCells, which also counts cells wrapped
in a UserObject/object
- DiagramOperation is the MCP type
- The wrapped-cell and empty-diagram tests now run against the MCP code
- New e2e test: edit_diagram changes the canvas, and a failing edit
leaves it as it was
* refactor(web): share prompt examples and the shape library with the MCP server
- The three XML examples (swimlanes, two edges, waypoints) that the web
system prompt, the display_diagram description and the MCP drawing
guide each had a copy of now live in packages/mcp-server/src/xml-examples.ts
- The shape library group list and reader come from the MCP
shape-library.ts; getShapeLibrary takes the folder, and the web route
passes docs/shape-libraries under the working directory as before.
Only the 30 known library names are read. Error texts differ slightly
- next.config.ts traces docs/shape-libraries/*.md for /api/chat, since
the read now happens in another module
- Every prompt is byte-for-byte unchanged: the web system prompt for five
model ids with and without minimal style, and the MCP drawing guide,
compared before and after; the library list and swimlane example match
the old tool description text exactly
* fix(providers): update the v6 SDK packages and fix Claude and Gemini settings
- Update ai to 6.0.300 and the @ai-sdk providers to their latest v6-line
versions. @ai-sdk/anthropic 3.0.47 did not know claude-opus-4-7/4-8
and capped their output at 32000 tokens; 3.0.127 allows 128000
- Drop the fine-grained-tool-streaming beta header for the Anthropic API:
the provider now streams tool input per tool (eager_input_streaming)
- Claude 4.7 and later reject a non-default temperature/top_p/top_k and
the extended thinking budget with a 400. A middleware retries once
without them, so TEMPERATURE and *_THINKING_BUDGET_TOKENS no longer
break those models
- Prompt caching also reaches Claude on the Anthropic API and OpenRouter;
before, only Bedrock got a cache marker
- GOOGLE_TOP_K and GOOGLE_TOP_P never reached Gemini: they were sent as
Google provider options, which drops them. They are call settings now.
GOOGLE_CANDIDATE_COUNT and GOOGLE_REASONING_EFFORT, which the provider
does not support, are removed
- Add @ai-sdk/openai-compatible as a direct dependency
* refactor: simpler streaming preview and small AI SDK cleanups
- useChat throttles streamed message updates (experimental_throttle,
150 ms), replacing the two hand-written 150 ms timers of the
display_diagram and edit_diagram previews (94 lines less). The preview
now only runs while the input streams; once it is complete the tool
handler takes over, so a queued preview can no longer redraw an edit
the handler rejected and rolled back. Measured on a streamed 60-cell
diagram: 41 redraws at least 97 ms apart, before 37 with gaps down to
48 ms
- The diagram check endpoint uses streamText with Output.object instead
of the deprecated streamObject, and returns its fixed result as a plain
text response; new route test
- Import createGateway/gateway from ai and drop the direct
@ai-sdk/gateway dependency
- The per-request message structure logs only print with
DEBUG_LLM_PAYLOAD=true
- Remove an empty onFinish callback
* refactor(chat): check the last tool part with the SDK's isToolUIPart
Drop the hand-written MessagePart and ChatMessage types that only served
this check.
* refactor(providers): one model factory for chat and the settings Test button
- getAIModel resolves credentials (client key, server env vars, the
existing SSRF rules) and createModel builds the model by SDK. The
provider-by-provider switch shrinks from 24 cases to the few that
differ (lib/ai-providers.ts 1531 -> 1106 lines)
- /api/validate-model calls getAIModel instead of its own 24-case switch
(503 -> 175 lines), which had drifted from the chat: it built Azure
with createOpenAI, Kimi and MiMo with createOpenAI instead of
createDeepSeek, and the official OpenAI endpoint with Chat Completions.
A passing test now means the chat works
- Plain OpenAI-compatible providers (SiliconFlow, SGLang, ModelScope,
GLM, Qwen, Qiniu, Novita, Atlas Cloud, EdgeOne, Doubao, MiniMax in
OpenAI mode, AIHubMix on a custom URL) use @ai-sdk/openai-compatible,
which reads reasoning_content, so their reasoning shows, and accepts
SGLang's stream as is (its 95-line stream rewrite is gone).
includeUsage keeps token usage for quotas. <think> tags in their text
become reasoning (extractReasoningMiddleware)
- SGLang without a base URL used OpenAI's endpoint; it now defaults to
http://127.0.0.1:8000/v1 like the Test button did
- Chat requests to a client base URL refuse redirects, as the Test
button already did (redirectGuardedFetch moves to lib/ssrf-protection)
- The Test button streams like the chat (the ModelScope special case is
gone), times out after 15 s, does not retry, asks the model to call a
ping tool and warns when it answers without one, and tests all models
at once. The time each test took shows on its check mark
- Unknown provider names are rejected with Object.hasOwn, and the error
texts list providers from PROVIDER_INFO instead of hand-kept lists
* feat(settings): link to each provider's key page and clean up base URLs
- A "Get API key" link next to the API Key field for the 19 providers
that have a key page (from env.example and the providers' docs). 17
answered 200 to curl; OpenAI's is behind a Cloudflare challenge and
DeepSeek's behind a regional block, both checked in Chrome
- Base URLs drop spaces, trailing slashes and a pasted endpoint path
(/chat/completions, /completions, /messages, /responses), which the
SDK would otherwise append a second time and get a 404. getAIModel does
this for the chat and the Test button; the field does it on blur and
shows the URL requests go to
* feat(errors): classify provider errors and show a hint the user can act on
- lib/llm-errors.ts sorts an error into about a dozen kinds (key
rejected, no access, unknown model, no credit, rate limited, context
too long, no image input, no tool calls, output cut off, provider down,
cannot connect, timeout): first texts that name the cause precisely,
then the HTTP status code, then general texts. It unwraps RetryError and
hides keys and Bearer tokens in the provider's message
- The chat route uses it for errors before the stream and, through
toUIMessageStreamResponse's onError, for errors in the stream. Errors
of the model's own tool call stay as they are: the same text goes back
to the model so it can fix the call
- The chat shows the hint in the user's language, then the provider's
message; a rejected key, missing access or unknown model adds an "Open
model settings" button. The Test button shows the same hints
- Fixes: our message "API key is required when using a custom base URL"
was replaced by "Authentication failed" because it contains "key"; a
provider's "Rate limit exceeded" opened this site's quota toast; an
error body like {"error": ...} was shown as raw JSON; the Test button
matched "401" in the message, where providers rarely put it
- Remove the string matching fallbacks in the chat panel
* refactor(settings): drop an unused index parameter
* feat(settings): fetch the model list from any provider and flag models that cannot draw
The "Fetch models" button asks the provider for its models (OpenAI-style
/models, Anthropic, Google, Ollama, OpenRouter, Vercel Gateway, AIHubMix)
and shows them in a searchable picker. This replaces the route that only
worked for AIHubMix.
A snapshot of models.dev (MIT) says which models support tool calls.
Models without them get a "no tool calls" badge in the picker and a hint
in the model list, since drawing needs tool calls. Refresh the snapshot
with scripts/update-model-catalog.mjs.
* fix(mcp-server): reject text between tags, which draw.io cannot open
draw.io reads any text inside a page as compressed page data, so a stray
text node makes the whole page fail with an atob error. gpt-5-mini sends
new cells with a literal "\n" between the tags; the edit card said
Complete while draw.io showed the error and kept the old diagram.
Validation now reports text between tags, and auto-fix turns a literal
\n, \t or \r between tags into whitespace. Other text goes back to the
model as an error. The compressed data directly under <diagram> is fine.
* fix(chat): clearer provider errors and no empty bubble, found with real models
- An error object sent inside the stream (OpenRouter's { code, message })
showed as "[object Object]"; its message and status code are read now.
- A problem+json "detail" is added to the message: NVIDIA only said
"Gone" for a retired model. 410 counts as model not found.
- "Cannot connect to API" from the SDK gets the connection hint.
- Text that is only whitespace (Kimi K2.6 sends a space before a tool
call) no longer shows an empty bubble.
- allowSystemInMessages stops the warning on every request. Our system
messages carry cache points; a client's own system messages are already
dropped by the empty-content filter.
* feat(providers): suggest the Claude 5 and GPT 6 models, show GPT 6 reasoning
The suggested models stopped at Claude Opus 4.8 and GPT 5.5. They now
start with Claude Opus 5.5, Sonnet 5.5 and Fable 5.1, and gpt-6.1-sol,
gpt-6-sol, gpt-6-luna and gpt-6-astra (ids checked against the provider
lists). The Bedrock list is unchanged until its ids are checked.
The reasoning summary was only turned on for model ids containing o1,
o3, o4 or gpt-5, so GPT 6 models showed no thinking. It now matches the
o-series and gpt-5 or later by version, like the OpenAI SDK.
* fix(providers): keep thinking on the newest Claude models, fix the Bedrock ids
Measured on Bedrock: Claude Opus 4.7, 4.8 and every Claude 5 model reject
a thinking budget ("thinking.type.enabled") and a temperature, and all of
them accept adaptive thinking. The retry used to drop thinking, so with
a thinking budget set these models did not think at all. It now switches
to adaptive thinking with display "summarized"; without that setting the
models think but send no thinking text to show.
The suggested Bedrock ids had no region prefix, and the newer models only
answer through an inference profile id: "anthropic.claude-sonnet-5-5"
fails with "on-demand throughput isn't supported". Each suggested id was
called once; the Claude ones now start with "global.", Llama, Pixtral and
Nova 2 Lite with "us.". Nova Premier (end of life) and the ids without a
working profile are gone. The docs example had the same problem and a
wrong date.
* fix(chat): an edit after a broken edit call no longer fails, found with Opus 5.5
- Claude Opus 5.5 sent an edit with invalid JSON, then the same edit
again. The first call's streamed preview was never undone: its input
has no operations, and the undo sat behind that check. The second edit
then started from the preview, failed on a duplicate id, and the model
had to try a third time. The undo now runs first, and an edit that
starts in the same render uses the undone diagram.
- The SDK passes an invalid tool call's error as a string, which was
wrapped as a provider error. streamErrorText keeps it as the text the
model reads.
- Bedrock's "on-demand throughput isn't supported" gets the model id hint.
- The thinking header uses the page language ("Thought for 1 second" in
English), from the dictionary entries that were already there.
* chore(mcp-server): release the new features as 0.3.0
npm has 0.2.3. The earlier commits raised the version step by step to
0.6.0, but they ship together as one release.
* style: auto-format with Biome
* fix(chat): draw the built-in examples again and undo edit previews on errors
Found by the PR review:
- The built-in examples showed a finished card and an empty canvas. They
are answered in the browser, never reach the tool handler, and relied
on the final redraw that an earlier commit removed. The example branch
now loads its diagram itself.
- When the request failed while an edit was streaming (a provider error,
a lost connection), its preview stayed on the canvas. The error handler
now restores the diagram from before the preview.
- The model picker could not scroll with the wheel or touch: the settings
dialog blocks those events outside itself, and the picker is rendered
outside it. The popover is modal now.
- A fetch error and the open picker stayed when switching providers.
- Editing a model id kept the old test warning and response time, which
also hid the "may not be able to draw" hint for the new id.
* fix(mcp-server): keep both pages when get_diagram meets a page export, and more review fixes
Found by the PR review, each with a test that failed first:
- get_diagram during a page export returned the one-page projection on
screen as the whole document (6 of 6 times when timed so). The preview
page no longer answers a sync while a projection shows, and syncs after
reloading, so the poll that restores the real document exports it.
- Exports are numbered on the server too: a late result of an export that
timed out was saved as the next export's file.
- In Chrome, a new_xml with a syntax error counted the <parsererror>
element as a second cell, so the web app rejected edits that auto-fix
repairs ("must contain exactly one cell").
- hasCells missed single-quoted ids, so screenshot_diagram called such a
diagram empty and auto-save never created its file.
- A literal \n directly under a <diagram> that has a model passed
validation; only text-only pages are compressed data.
- A wrapped mxCell repeating its UserObject's id took the wrapper's place
in edits, so delete and update left an empty or nested wrapper.
- Bare cells with a shape or edge id of "0" or "1" are rejected with a
clear message instead of being renamed, which broke their edges.
- DRAWIO_DATA_DIR expands ~, which JSON configs pass on as it is.
* fix(server): count quota by the key actually used, and more review fixes
Found by the PR review, each with a test that failed first:
- Quota: any key header skipped it, even one the provider never reads
(x-aws-access-key-id with OpenAI), so a request ran on the server's
key without being counted. The check now runs after the model is
resolved and uses usesServerCredentials. On main already.
- usesServerCredentials read the raw base URL; "/" cleans up to none, so
an Ollama request ran on the server's key past the server-model check.
- SGLang's default 127.0.0.1:8000 only fills the settings form. Chat and
the model list used it as a real address, so the server called its own
machine even with private URLs blocked. Now a base URL is required.
- With a user's OpenAI key and no base URL, the SDK read the server's
OPENAI_BASE_URL. The official endpoint is now passed. On main already.
- The Test button refused nothing on the server's keys (Ollama Cloud),
and a 15 s timeout reported "connected, no tool call".
- The model list for Ollama without a base URL came from ollama.com while
chat went to the server's Ollama.
- Bedrock's "Too many tokens, please wait" counted as context too long.
- On the server's keys the provider's error text stays in the server log;
it can name the server's AWS account, role or internal hosts.
- Desktop app: the preset keys are the user's own (NEXT_AI_DRAWIO_DESKTOP),
so Max Output Tokens can be raised and keyless models in settings work
again. A launch that found the remembered port taken no longer replaces
it, which hid the user's chats and settings for good.
* ci: run auto-format with the Biome version in package.json again
package.json moved to Biome 2.5.7 but the auto-format job stayed on
2.4.13. The two format some files differently, so on this PR the bot
reformatted tests/unit/log-save-route.test.ts with 2.4.13 and the lint
job, on 2.5.7, then failed on it. The pin now matches package.json, as
its comment asks, and the file is back in 2.5.7's format.
* fix(chat): keep the canvas after an unrelated error, and more review fixes
Found by the second PR review:
- After a streamed edit, an older render of the stream stored the edit's
original diagram again, and the next failed request (no quota, a lost
connection) put that old diagram back on the canvas. The tool handler
now marks its call as handled, so the preview code leaves it alone.
- An edit applied before the UI showed an earlier broken edit's error was
erased when that error undid its preview, or was built on that preview.
The handler now starts from the diagram before all unhandled previews,
and reads the diagram state that updates at once.
- A failed or stopped display_diagram left its half drawn diagram on the
canvas. Its preview is undone now, like an edit's.
- "New chat" cleared a chat that could not be saved (storage full).
- The settings dialog showed a model list, a fetch error or a test result
on the provider that was opened after the request started, and marked a
model id changed during the test as tested.
- A tool call with broken JSON was shown as cut off by the output limit.
- History entries and session thumbnails could pair with a later diagram
when draw.io answered an export late.
- A server model saved before non-ASCII provider names got into the id
was reset to the default model.
* fix(mcp-server): count a one-page view only for that page, and more review fixes
Found by the second PR review:
- get_diagram with a page selector, or a rejected edit's error, counted
the whole document as seen, so an edit on another page could overwrite
the user's change there. A one-page view now counts for all pages only
if the others are unchanged; otherwise the reply says to get them.
- add_page accepted shapes with the root cell ids "0" and "1" and renamed
them, breaking their edges. The check also missed ids on UserObject
wrappers and ids written with spaces around the "=".
- Root cells written over two lines were kept as an extra layer, cells
with id = "a" did not count as cells, and CDATA text before a page's
model passed the check although draw.io cannot open the page.
- Auto-save cleanup deleted the user's own files that start with mcp-.
Only names in the session id format are removed now.
- Restoring a history entry dropped edits made in the browser since the
last entry. They are added to history first.
- A session whose state expired showed a blank page, and the next change
overwrote its auto-save file. The saved file is loaded instead.
- An edit on a page export's one-page projection, made before the real
document was back, replaced the whole document.
- A late sync reply could overwrite a newer edit: each sync export is
numbered, and the server ignores replies older than the current state.
- screenshot_diagram could return another session's image after
start_session ran during its retries.
* fix(server): use the keys the user sent, and more review fixes
Found by the second PR review:
- With AWS_BEARER_TOKEN_BEDROCK set on the server, a request with the
user's AWS keys ran on the server's token: the Bedrock SDK prefers it.
Checked with Bedrock: invalid user keys used to get an answer.
- An OpenAI key with the official URL filled in (the settings form does
that) went to the Responses API. Back to main's rule: a configured base
URL uses Chat Completions.
- A user's Ollama key went to the server's OLLAMA_BASE_URL, for chat and
for the model list. Like every other provider, it goes to the user's
base URL or Ollama Cloud.
- The server's keyless Ollama and EdgeOne were not counted in the quota.
- AI_MODEL models on the server's keys ran on any provider with a server
key, not only on AI_PROVIDER.
- A user's Azure key without a base URL used the server's resource name.
- The admin panel's Test button failed whenever access codes were set.
- DeepSeek's errors in the stream (plain text) were shown as they were,
without a hint and also on the server's keys. Bedrock's throttling in
the stream was not recognised as a rate limit.
- The EdgeOne function accepted text/plain; x=application/json, which
other sites can send without a CORS preflight.
- Desktop app: a launch that found the old port taken for a moment (the
previous version still quitting after an update) remembered the new
port for good. The new port is kept only when Windows reserves the old
one. A failed read of the presets file moved it aside as corrupt, and a
save could then replace the presets. Switching presets on the same port
now reloads the page. The dev launcher no longer misses a preset change
made before or during a restart.
* fix(chat): undo rejected or stopped previews, and more fixes from the third review
- A call the server runs (get_shape_library) still reaches the browser's
tool handler, and it dropped the stored diagram of an earlier broken
edit, whose preview then stayed. Only the tools that draw take it now.
- A display_diagram whose final XML fails the checks loads the diagram
from before its preview again, as a failed edit does.
- After Stop, a tool result that arrives later (a screenshot check still
running) no longer sends a new request; Stop also skips calls the tool
handler already took.
- New chat and opening another chat kept nothing of a diagram drawn
without messages when it could not be saved; now they stay on it.
- The settings dialog drops a model list or test result whose provider
credentials changed meanwhile, also in another tab.
- A saved provider this version does not know crashed the whole page on
load; it is skipped.
- The input emptied a moment after the message showed in the chat, so it
briefly appeared twice (seen as a flaky e2e test).
- The desktop app's preset switch on the same port refetches the server
models instead of reloading the page, which lost unsent attachments.
* fix(mcp-server): recover sessions in one place, and more fixes from the third review
- A session whose state expired was recovered from its auto-save file only
for the preview page; the tools built on their older copy and then
overwrote the file. They now recover it first (restoreSavedSession).
- A preview tab that missed the last AI write pushed its older diagram
over the recovered one after a restart. It now shows the recovered
diagram and keeps its own copy in History.
- An empty record of what the model has seen (after load_diagram or a
page tool on unseen changes) no longer lets one page of a multi-page
document count for all, and get_diagram counts a page only once found.
- History: a thumbnail goes only to the entry it shows, the cached image
never belongs to an older diagram, a re-serialized copy adds no entry,
and a cleared document with its own pages is kept before a restore.
- The root cell id check reads attributes one by one: rack-id="1" or id
text inside a label no longer counts.
- A compressed page counts as having cells; a saved file that could not
be read is never written over.
* fix(server): keep users' keys at their own endpoints, and more fixes from the third review
- Bedrock: a user's AWS keys no longer go to an endpoint the server sets
in AWS_ENDPOINT_URL_BEDROCK_RUNTIME / AWS_ENDPOINT_URL (read by the
upgraded SDK), and admin panel keys win over AWS_BEARER_TOKEN_BEDROCK,
as the Test button checks them. Checked with Bedrock.
- Ollama: a server key without a base URL (admin panel, OLLAMA_API_KEY)
goes to Ollama Cloud, as env.example says, instead of 127.0.0.1.
- Quota: EdgeOne counts whatever key header comes along, keyless Ollama at
a private address counts, and their provider texts stay in the log.
- An EdgeOne server model (admin panel, ai-models.json) works: the route
checked the raw provider header, which holds the name's slug.
- parse-url ends downloads it does not read (too large, PDF, errors).
- Desktop app: the port follows where the chats are (IndexedDB per
origin) instead of a remembered port, which could hide them for good;
a same-port restart tells the page to refetch the server models; a
failed preset switch no longer undoes a newer choice; a presets file
removed after a failed read can be saved again; .env values quoted from
start to end keep their inner quotes, as dotenv reads them.
* fix(security): check request sources, regions and endpoints
- Bedrock: a request's AWS region must be a region name. It becomes part
of the endpoint's host name, so a value such as
"us-east-1.attacker.example/" sent the server's bearer token or signed
request to another host.
- MCP preview server: only the preview page itself (Origin equal to the
Host) or a non-browser client may call it; a page on another localhost
port could replace the diagram with a plain text POST. History builds
its thumbnails element by element and shows only SVG data images, so a
stored value can no longer run script in the preview.
- chat, validate-model, validate-diagram, provider-models and parse-url
take JSON bodies only, so another website cannot make the user's own
server (the desktop app, a local install) run models with their keys;
the desktop app also refuses a foreign Host (DNS rebinding).
- The model list reads at most 2 MB, also through the Gateway SDK, and
answers only with its own error texts: the URL is the caller's and may
be an internal address.
- An admin panel provider with its own key and no URL no longer inherits
the global <P>_BASE_URL, which may be a proxy for another key; OpenAI
then gets the official endpoint, as its Test. Azure keeps the server's
resource.
* fix: what the third round broke, and the first batch's review
MCP preview after the server lost a session (it expired, or the MCP
process restarted):
- Every server state has an id, made when the state is created. The tab
notices a new id even when the version numbers happen to match, and
every push names the state it was based on, so one based on a lost state
is refused, also when it comes before the tab's first poll (the server
recovers the saved file first).
- The tab keeps the newest canvas XML, saved or not. When the server knows
nothing (no file) or exactly what the tab last saved, the canvas wins and
is saved, so edits made while the server was down are kept. Otherwise
the server's diagram (an AI write the tab missed, a cleared document
that was saved) is shown and the tab's copy goes to History.
- Late answers to an old state's push or poll are dropped; a failed push
says the server is unreachable; Download as .drawio saves the canvas.
Settings and server:
- Saved providers this version does not know stay in storage with their
keys, and sending no longer trips over them.
- The desktop "Ollama (Local)" preset with a key goes to local Ollama
again; a server model's Ollama URL variable is read; the admin panel
writes Ollama Cloud's URL for a key without one.
- Provider error texts show again in the desktop app and for EdgeOne.
- .env: a quoted value followed by a comment ending in a quote is read as
dotenv reads it; unquoted values are unchanged.
- Desktop app: the next launch opens the port where a chat was last
saved; a launch elsewhere that saves nothing does not move it, and a
page with no chats lets the next launch try the other port once.
- The Test button no longer stays busy after another tab changed the key.
- A completed append_diagram is no longer undone by an earlier failed
edit's preview; a file read once in vain is saved again once it is read
or gone.
From the first batch's review:
- The admin panel's Test of an entry without a URL now tests the server's
<P>_BASE_URL, where chat sends the entry's key; chat is unchanged (the
first fix rerouted working setups).
- The model list ends downloads that are too large, accepts answers
without a body, and keeps the "redirects are not allowed" explanation.
- A test covers the preview's History rendering.
* fix: older defects (batch C) and the second batch's review
Chats:
- New Chat right after an answer saves that chat once. Saves run one at
a time and read the chat on screen when their turn comes; a save
scheduled for a chat that is no longer on screen is dropped. A chat
whose id was still on its way to the URL no longer comes back after
New Chat (the next answer went into it).
- Crossing the 768 px breakpoint keeps the chat panel: a streaming answer,
unsaved messages and attachments stay. The panel gets the sizes of each
side, and a panel collapsed on desktop opens on mobile.
- The chat's export waits for its own reply: an edit's history export
still on its way no longer answers it with the older diagram, and two
file saves at once no longer swap results.
- A second edit in one answer is previewed on the first edit's result.
- Stop also ends a running screenshot check; a chat that cannot be saved
(storage full) can be left with "Continue without saving".
- Small diagrams with shapes count as diagrams; the tool card no longer
crashes on malformed operations.
Quota and providers:
- Requests that reach the server's own endpoints count toward the quota:
EdgeOne (always its own endpoint now), a private base URL whatever key
header is sent, keyless Ollama without a URL. With the quota on, a
redirect is followed only to a public address. The output cap applies
to these requests too.
- Stop records the tokens of the steps that finished; the screenshot check
counts its tokens without counting a request.
- EdgeOne configured only by AI_PROVIDER works, also in the admin Test,
which forwards the access code. Azure set up only in the admin panel
works in chat. The Test sends a Bedrock session token.
- The admin panel's Test of an entry without a URL uses the server's URL
as the server does (no private address check for it); the admin panel
no longer writes an Ollama URL.
MCP server:
- Write tools and start_session run one at a time, so two at once never
drop each other's change; a cancelled call waiting its turn is skipped.
get_diagram and export_diagram keep the session they started with.
- Export to .drawio first gets the user's latest edits from the browser.
- History thumbnails: one that arrives after the next AI write is
dropped; a sync reply keeps the image; a version that changed only page
settings is its own entry.
- A diagram over the 10 MB limit is saved without its image, or the user
is told to download it (the server now answers 413 instead of cutting
the connection).
- Labels holding text like id='1' or parent='1' are no longer read as
attributes (a layer or a parent was deleted). A broken bare
<mxGraphModel> file is refused.
- After a sync reply the tab no longer sends its autosave copy again.
Desktop and files:
- A newer switch of the same preset is not rolled back by an older one
that failed. .env values with escaped quotes are read whole.
- MCP saved files: a file that could not be read stays protected while a
folder without permission hides it, and is saved again once deleted.
- The desktop app reports "no chats" only when the count was read and no
model settings are stored.
* fix: what the batch C review found
- A redirect followed for a custom base URL (quota on) no longer carries
the user's key or cookies to another origin, as fetch itself does, and
a private address may redirect to another private one (already counted).
- The admin Test of an Ollama or Vertex AI entry without a URL goes where
chat sends that entry's key: the environment's own URL variable, for
Ollama else the local default. The Test of an Ollama Cloud key without
a URL went to the cloud while chat went to local Ollama.
- Chat saves: each save notes the chat on screen and the order of the
reads before reading its data. A save read before switching chats no
longer writes into the chat switched to, and a copy that waited for its
thumbnail no longer replaces a newer one.
- "Continue without saving" keeps its button when a later auto-save fails,
and goes away when a new message is sent.
- A screenshot check that was waiting for its image when the user pressed
Stop stays skipped after the next message.
- MCP History: draw.io's own copy of a diagram (after get_diagram) no
longer adds an entry without a picture; a change of background is still
its own version. The tab ignores an edit's answer that arrives after a
newer AI write loaded.
- Desktop: a deleted preset is not brought back by a failed switch, and a
request naming no preset does not stop a rollback. An origin keeping
an access code counts as having settings.
- .env: a quoted value ending in a backslash ("C:\dir\") is read as dotenv
reads it.
- The tool card no longer crashes on an id that does not turn into text;
an older Test's success timer no longer ends a newer Test's spinner.
- Tests that passed without their fix now check it.
* fix: what the whole-PR review and Copilot found
- A redirect followed for a custom base URL also drops the key headers of
providers that do not use Authorization (x-api-key, x-goog-api-key,
api-key) when it goes to another origin.
- A second Enter or click while a message is being prepared (attachments
read, diagram exported) no longer sends it twice.
- The admin Test on the deployment's own endpoints (EdgeOne, the server's
keyless Ollama, an address on the server's network) counts toward the
quota like a chat; the chat and the Test share one rule for it. The
Test of an Azure entry set up by AZURE_RESOURCE_NAME only goes where chat
goes.
- EdgeOne's function is called at the site root again, as on main: EdgeOne
serves edge functions there, outside Next's base path.
- MCP History: the state before a write is kept unless the browser saved
no change of the user's since the last server write (draw.io's sync copy
of it adds no entry), and the dedupe compares the exact text again, so a
change of page size or other settings only is its own version.
- MCP: an edit keeps untouched labels as draw.io shows them (a literal line
break in an attribute is a space); a new document of empty pages the
user named is auto-saved; load_diagram reads only regular files, so a
pipe cannot hold up the other write tools; the preview does not load
back its own push still on its way (an undo made meanwhile is saved).
- Two overlapping saves of a new chat no longer reload the canvas from the
older copy.
- At most three screenshot checks per user turn, passed or failed, as
documented.
- Desktop: the main window navigates only within the app (draw.io stays in
its frame); a presets file that is not JSON and cannot be moved aside is
not overwritten.
- A last self-closing cell with a raw "<" in a value is not taken for cut
off output.
- README: Material Design shapes load their icons from fonts.gstatic.com.
* fix(chat): stop saving and exporting an idle chat every second
Each auto-save takes a thumbnail, and draw.io's SVG gets a new random id
every time, so latestSvg changed and the diagram context rendered again.
getThumbnailSvg was a new function on every render, the auto-save depends
on it, so the next save was scheduled a second later: a chat with some
diagrams was saved and exported once a second for as long as it was open.
getThumbnailSvg (and the export helper it uses) now keep one identity;
they read refs only.
Found by hand in the production build; the new e2e test fails without the
fix on a production build (as CI runs it).
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
579 lines
27 KiB
JSON
579 lines
27 KiB
JSON
{
|
||
"common": {
|
||
"save": "保存",
|
||
"cancel": "取消",
|
||
"close": "关闭",
|
||
"confirm": "确认",
|
||
"clear": "清除",
|
||
"edit": "编辑",
|
||
"delete": "删除",
|
||
"loading": "加载中...",
|
||
"new": "新建"
|
||
},
|
||
"nav": {
|
||
"about": "关于",
|
||
"editor": "编辑器",
|
||
"newChat": "开始新对话",
|
||
"github": "GitHub",
|
||
"settings": "设置",
|
||
"hidePanel": "隐藏聊天面板 (Ctrl+B)",
|
||
"showPanel": "显示聊天面板 (Ctrl+B)",
|
||
"aiChat": "AI 聊天"
|
||
},
|
||
"providers": {
|
||
"useServerDefault": "使用服务器默认值",
|
||
"openai": "OpenAI",
|
||
"anthropic": "Anthropic",
|
||
"google": "Google",
|
||
"azure": "Azure OpenAI",
|
||
"openrouter": "OpenRouter",
|
||
"deepseek": "DeepSeek",
|
||
"siliconflow": "SiliconFlow",
|
||
"modelscope": "ModelScope",
|
||
"minimax": "MiniMax",
|
||
"glm": "GLM",
|
||
"qwen": "Qwen",
|
||
"kimi": "Kimi",
|
||
"qiniu": "Qiniu",
|
||
"mimo": "MiMo (小米)"
|
||
},
|
||
"chat": {
|
||
"placeholder": "描述您的图表或上传文件...",
|
||
"send": "发送",
|
||
"stopGeneration": "停止生成",
|
||
"sendMessage": "发送消息",
|
||
"clearConversation": "清除对话",
|
||
"diagramHistory": "图表历史",
|
||
"saveDiagram": "保存图表",
|
||
"uploadFile": "上传文件(图片、PDF、文本)",
|
||
"minimalStyle": "简约",
|
||
"styledMode": "精致",
|
||
"minimalTooltip": "使用简约模式以加快生成速度(无颜色)",
|
||
"regenerate": "重新生成响应",
|
||
"copyResponse": "复制响应",
|
||
"copied": "已复制!",
|
||
"failedToCopy": "复制失败",
|
||
"failedToCopyDetail": "复制消息失败。请手动复制或检查剪贴板权限。",
|
||
"goodResponse": "有帮助",
|
||
"badResponse": "无帮助",
|
||
"clickToEdit": "点击编辑",
|
||
"editMessage": "编辑消息",
|
||
"saveAndSubmit": "保存并提交",
|
||
"ExtractURL": "从 URL 提取"
|
||
},
|
||
"examples": {
|
||
"title": "用 AI 创建图表",
|
||
"subtitle": "描述您想要创建的内容或上传图片进行复制",
|
||
"quickExamples": "快速示例",
|
||
"paperToDiagram": "文档转图表",
|
||
"paperDescription": "上传 .pdf, .txt, .md, .json, .csv, .py, .js, .ts 等文件",
|
||
"animatedDiagram": "动画图表",
|
||
"animatedDescription": "绘制带有动画连接器的 Transformer 架构",
|
||
"awsArchitecture": "AWS 架构",
|
||
"awsDescription": "使用 AWS 图标创建云架构图",
|
||
"replicateFlowchart": "复制流程图",
|
||
"replicateDescription": "上传并复制现有流程图",
|
||
"creativeDrawing": "创意绘图",
|
||
"creativeDescription": "绘制有趣且富有创意的内容",
|
||
"cachedNote": "示例已缓存,可即时响应",
|
||
"mcpServer": "MCP 服务器",
|
||
"mcpDescription": "在 Claude Desktop、VS Code 和 Cursor 中使用"
|
||
},
|
||
"settings": {
|
||
"title": "设置",
|
||
"description": "配置您的应用程序设置。",
|
||
"apiKeysModels": "API 密钥和模型",
|
||
"apiKeysModelsDescription": "配置 AI 提供商和 API 密钥。",
|
||
"accessCode": "访问码",
|
||
"accessCodePlaceholder": "输入访问码",
|
||
"accessCodeDescription": "使用此应用程序需要访问码。",
|
||
"aiProvider": "AI 提供商设置",
|
||
"aiProviderDescription": "使用您自己的 API 密钥来绕过使用限制。您的密钥仅存储在浏览器本地,不会存储在服务器上。",
|
||
"provider": "提供商",
|
||
"modelId": "模型 ID",
|
||
"apiKey": "API 密钥",
|
||
"apiKeyPlaceholder": "您的 API 密钥",
|
||
"baseUrl": "基础 URL(可选)",
|
||
"customEndpoint": "自定义端点 URL",
|
||
"overrides": "覆盖",
|
||
"clearSettings": "清除设置",
|
||
"useServerDefault": "使用服务器默认值",
|
||
"language": "语言",
|
||
"languageDescription": "选择界面语言。",
|
||
"theme": "主题",
|
||
"themeDescription": "界面和 DrawIO 画布的深色/浅色模式。",
|
||
"drawioStyle": "DrawIO 样式",
|
||
"drawioStyleDescription": "画布样式",
|
||
"themeDefault": "默认",
|
||
"themeDark": "深色",
|
||
"themeMinimal": "简约",
|
||
"themeSketch": "草图",
|
||
"themeSimple": "简单",
|
||
"diagramStyle": "图表样式",
|
||
"diagramStyleDescription": "切换简约与精致图表输出模式。",
|
||
"sendShortcut": "发送快捷键",
|
||
"sendShortcutDescription": "选择发送消息的方式。",
|
||
"enterToSend": "回车发送",
|
||
"ctrlEnterToSend": "Cmd/Ctrl+回车发送",
|
||
"diagramActions": "图表操作",
|
||
"diagramActionsDescription": "管理图表历史记录和导出",
|
||
"history": "历史记录",
|
||
"download": "下载",
|
||
"proxy": "代理设置",
|
||
"proxyDescription": "配置 API 请求的 HTTP/HTTPS 代理(仅桌面版)",
|
||
"httpProxy": "HTTP 代理",
|
||
"httpsProxy": "HTTPS 代理",
|
||
"applyProxy": "应用",
|
||
"proxyApplied": "代理设置已应用",
|
||
"diagramValidation": "图表验证(实验性)",
|
||
"diagramValidationDescription": "使用视觉语言模型验证生成的图表。需要支持视觉的模型,如 GPT-5.2 或 Sonnet-4.5。",
|
||
"enabled": "已启用",
|
||
"disabled": "已禁用",
|
||
"customSystemMessage": "自定义系统消息",
|
||
"customSystemMessageDescription": "添加自定义指令,将附加到 AI 的系统提示末尾。",
|
||
"customSystemMessagePlaceholder": "例如:图表始终使用蓝色配色方案...",
|
||
"maxOutputTokens": "最大输出 token 数",
|
||
"maxOutputTokensDescription": "单次回复的额度,思考过程和图表 XML 共用。如果 AI 一直在思考却没有生成图表,请把它调大。留空则使用默认值。",
|
||
"panelVisibility": "大厅面板",
|
||
"panelVisibilityDescription": "选择在聊天大厅显示哪些面板。",
|
||
"showRecentChats": "最近聊天",
|
||
"showMyTemplates": "我的模板",
|
||
"showQuickExamples": "快速示例"
|
||
},
|
||
"save": {
|
||
"title": "保存图表",
|
||
"description": "选择格式和文件名以保存您的图表。",
|
||
"format": "格式",
|
||
"filename": "文件名",
|
||
"filenamePlaceholder": "输入文件名",
|
||
"formats": {
|
||
"drawio": "Draw.io XML",
|
||
"png": "PNG 图片",
|
||
"svg": "SVG 图片",
|
||
"xmlsvg": "可编辑 SVG"
|
||
},
|
||
"savedSuccessfully": "保存成功!"
|
||
},
|
||
"history": {
|
||
"title": "图表历史",
|
||
"description": "在 AI 修改之前保存的每个图表。\n点击图表以恢复它",
|
||
"noHistory": "尚无历史记录。发送消息以创建图表历史。",
|
||
"version": "版本",
|
||
"restoreTo": "恢复到版本 {version}?"
|
||
},
|
||
"dialogs": {
|
||
"clearTitle": "清除所有内容?",
|
||
"clearDescription": "这将清除当前对话并重置图表。此操作无法撤消。",
|
||
"clearEverything": "清除所有内容",
|
||
"clearSuccess": "已开始新对话"
|
||
},
|
||
"errors": {
|
||
"maxFiles": "文件太多。最多允许 {max} 个。",
|
||
"onlyMoreAllowed": "只能再添加 {slots} 个文件",
|
||
"fileExceeds": "\"{name}\" 大小为 {size}(超过 {max}MB)",
|
||
"unsupportedType": "\"{name}\" 不是支持的文件类型",
|
||
"filesRejected": "{count} 个文件被拒绝:",
|
||
"andMore": "...还有 {count} 个",
|
||
"invalidAccessCode": "无效或缺少访问码。请在设置中配置。",
|
||
"networkError": "网络错误。请检查您的连接。",
|
||
"retryLimit": "已达到自动重试限制({max})。请手动重试。",
|
||
"continuationRetryLimit": "已达到继续重试限制({max})。图表可能过于复杂。",
|
||
"sessionCorrupted": "会话数据已损坏。重新开始。",
|
||
"failedToSave": "无法保存消息到 localStorage",
|
||
"failedToRestore": "无法从 localStorage 恢复",
|
||
"failedToPersist": "卸载前无法持久化状态",
|
||
"failedToExport": "获取图表数据时出错",
|
||
"failedToLoadExample": "加载示例图片时出错",
|
||
"failedToRecordFeedback": "记录您的反馈失败。请重试。",
|
||
"storageUpdateFailed": "聊天已清除,但无法更新浏览器存储",
|
||
"sessionSaveFailed": "无法保存这个对话。浏览器存储空间可能已满,请在历史记录里删除旧对话后重试。",
|
||
"sessionSaveFailedLeave": "无法保存这个对话,浏览器存储空间可能已满。可以不保存它、直接继续,再在新对话的列表里删除旧对话。",
|
||
"continueWithoutSaving": "不保存,继续",
|
||
"llm": {
|
||
"invalid_api_key": "服务商拒绝了这个 API Key,请在模型设置里检查。",
|
||
"forbidden": "服务商拒绝了这次请求。这个 Key 可能没有使用该模型或该地区的权限。",
|
||
"model_not_found": "服务商找不到这个模型,请在模型设置里检查模型 ID。",
|
||
"insufficient_quota": "服务商账户的余额或额度已经用完。",
|
||
"rate_limited": "服务商正在限制请求频率,请稍等片刻再试。",
|
||
"context_too_long": "对话内容超过了这个模型能处理的长度。请新开一个对话,或换一个上下文更长的模型。",
|
||
"images_unsupported": "这个模型不支持图片输入。",
|
||
"tools_unsupported": "这个模型不支持工具调用,而画图需要工具调用。请换一个模型。",
|
||
"output_truncated": "输出在图画完之前就被截断了。请简化请求,或在设置里调高输出上限。",
|
||
"provider_unavailable": "服务商出了问题,请稍后再试。",
|
||
"cannot_connect": "连接不上服务商,请检查 Base URL 和网络。",
|
||
"timeout": "服务商没有及时响应。",
|
||
"openModelSettings": "打开模型设置"
|
||
}
|
||
},
|
||
"quota": {
|
||
"dailyLimit": "已达每日配额",
|
||
"tokenLimit": "已达每日令牌限制",
|
||
"tpmLimit": "速率限制",
|
||
"tpmMessage": "请求过多。请稍等片刻。",
|
||
"tpmMessageDetailed": "达到速率限制({limit} 令牌/分钟)。请等待 {seconds} 秒后再发送请求。",
|
||
"messageApi": "看来您今天的体验次数已达上限。非常高兴您玩得开心,虽然本项目由字节跳动豆包慷慨赞助,但为了确保大家都能公平使用,我们不得不对使用量做一点小小的限制。",
|
||
"messageApiSelfHosted": null,
|
||
"messageToken": "看来您今天的 Token 用量已达上限。非常高兴您玩得开心,虽然本项目由字节跳动豆包慷慨赞助,但为了确保大家都能公平使用,我们不得不对使用量做一点小小的限制。",
|
||
"messageTokenSelfHosted": null,
|
||
"tip": "<strong>提示:</strong>您可以使用自己的 API 密钥(点击设置图标)或自托管项目来绕过这些限制。",
|
||
"tipSelfHosted": "<strong>提示:</strong>您可以在设置中配置自己的 API 密钥以继续使用服务。",
|
||
"reset": "您的限制将在明天重置。感谢您的理解。",
|
||
"doubaoSponsorship": "<a href=\"{link}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"underline hover:text-foreground\">点击此处注册</a>可获得每个模型 50 万免费 Token(包括豆包、DeepSeek 和 Kimi),然后在模型设置中配置您的 API Key。",
|
||
"configModel": "使用您的密钥",
|
||
"selfHost": "自托管",
|
||
"sponsor": "赞助",
|
||
"learnMore": "了解更多 →",
|
||
"usedOf": "{used}/{limit}"
|
||
},
|
||
"tools": {
|
||
"generateDiagram": "生成图表",
|
||
"editDiagram": "编辑图表",
|
||
"appendDiagram": "继续图表",
|
||
"complete": "完成",
|
||
"error": "错误",
|
||
"truncated": "已截断"
|
||
},
|
||
"file": {
|
||
"reading": "读取中...",
|
||
"chars": "字符",
|
||
"removeFile": "移除文件"
|
||
},
|
||
"url": {
|
||
"title": "从 URL 提取内容",
|
||
"description": "粘贴 URL 以提取和分析其内容",
|
||
"Extracting": "提取中...",
|
||
"extract": "提取",
|
||
"Cancel": "取消",
|
||
"enterUrl": "请输入 URL",
|
||
"invalidFormat": "URL 格式无效"
|
||
},
|
||
"reasoning": {
|
||
"thinking": "思考中...",
|
||
"thoughtFor": "思考了 {duration} 秒",
|
||
"thoughtForOne": "思考了 1 秒",
|
||
"thoughtBrief": "思考了几秒钟"
|
||
},
|
||
"dev": {
|
||
"title": "开发:XML 流式模拟器",
|
||
"preset": "预设:",
|
||
"selectPreset": "选择预设...",
|
||
"clear": "清除",
|
||
"placeholder": "在此粘贴 mxCell XML 或选择预设...",
|
||
"interval": "间隔:",
|
||
"chars": "字符:",
|
||
"streaming": "流式传输中...",
|
||
"simulate": "模拟",
|
||
"stop": "停止",
|
||
"testQuotaToast": "测试配额提示",
|
||
"simulatingMessage": "[开发] 模拟 XML 流式传输",
|
||
"successMessage": "成功显示图表。"
|
||
},
|
||
"about": {
|
||
"modelChange": "模型变更与用量限制",
|
||
"walletCrying": "(别名:我的钱包顶不住了)",
|
||
"seekingSponsorship": "寻求赞助(求大佬捞一把)",
|
||
"contactMe": "联系我",
|
||
"usageNotice": "由于使用量过高,我已将模型从 Claude 更换为 minimax-m2,并设置了一些用量限制。详情请查看关于页面。"
|
||
},
|
||
"sessionHistory": {
|
||
"tooltip": "聊天历史",
|
||
"newChat": "新对话",
|
||
"empty": "暂无聊天记录",
|
||
"emptyHint": "开始对话吧",
|
||
"today": "今天",
|
||
"yesterday": "昨天",
|
||
"thisWeek": "本周",
|
||
"earlier": "更早",
|
||
"deleteTitle": "删除此对话?",
|
||
"deleteDescription": "这将永久删除此聊天会话及其图表。此操作无法撤消。",
|
||
"recentChats": "最近对话",
|
||
"justNow": "刚刚",
|
||
"searchPlaceholder": "搜索对话...",
|
||
"noResults": "未找到对话"
|
||
},
|
||
"templates": {
|
||
"title": "我的模板库",
|
||
"subtitle": "您的个人 prompt 库,快速创建图表",
|
||
"emptyTitle": "暂无模板",
|
||
"emptyDescription": "创建您的第一个模板,开始构建个人 prompt 库",
|
||
"createFirst": "创建第一个模板",
|
||
"neverUsed": "未使用过",
|
||
"usedCount": "使用 {count} 次",
|
||
"myTemplates": "我的模板",
|
||
"createTitle": "创建模板",
|
||
"createDescription": "保存常用 prompt 以便重复使用。模板帮助您快速开始常用工作流。",
|
||
"promptLabel": "提示词",
|
||
"promptPlaceholder": "描述您想要创建的图表...",
|
||
"promptRequired": "提示词不能为空",
|
||
"titleLabel": "标题",
|
||
"titlePlaceholder": "输入标题",
|
||
"titleHint": "留空则使用提示词前 20 个字符作为标题",
|
||
"descriptionLabel": "描述",
|
||
"descriptionPlaceholder": "为此模板添加描述",
|
||
"pinnedLabel": "置顶模板",
|
||
"pinnedHint": "置顶的模板会显示在列表顶部",
|
||
"createButton": "创建模板",
|
||
"createFailed": "创建模板失败,请重试。",
|
||
"editTitle": "编辑模板",
|
||
"editDescription": "更新模板内容和设置。",
|
||
"updateFailed": "更新模板失败,请重试。",
|
||
"duplicate": "复制",
|
||
"copySuffix": "(副本)",
|
||
"deleteTitle": "删除此模板?",
|
||
"deleteDescription": "此操作将永久删除该模板,无法撤销。",
|
||
"confirmSendTitle": "替换当前输入?",
|
||
"confirmSendDescription": "您有未发送的内容。发送此模板将替换它。",
|
||
"confirmSendButton": "发送模板",
|
||
"searchPlaceholder": "搜索模板...",
|
||
"searchNoResults": "没有匹配的模板",
|
||
"pin": "置顶",
|
||
"unpin": "取消置顶",
|
||
"saveAsTemplate": "保存为模板",
|
||
"exportTemplates": "导出模板",
|
||
"importTemplates": "导入模板",
|
||
"exportEmpty": "没有可导出的模板",
|
||
"exportSuccess": "成功导出 {count} 个模板",
|
||
"importNoFile": "请选择一个 JSON 文件",
|
||
"importFailed": "导入失败:{error}",
|
||
"importSuccess": "成功导入 {imported} 个模板,跳过 {skipped} 个重复"
|
||
},
|
||
"validation": {
|
||
"title": "验证图表",
|
||
"capturing": "截图中",
|
||
"validating": "验证中",
|
||
"validatingWithAttempt": "验证中 ({attempt}/{max})",
|
||
"valid": "通过",
|
||
"validWithWarnings": "通过(有警告)",
|
||
"issuesFound": "发现问题",
|
||
"error": "错误",
|
||
"skipped": "已跳过",
|
||
"capturedScreenshot": "截图预览:",
|
||
"issuesFoundLabel": "发现的问题:",
|
||
"suggestions": "建议:",
|
||
"passedValidation": "图表通过视觉验证 - 未发现问题。",
|
||
"improvementRequested": "改进请求已发送 - 请查看下方新图表",
|
||
"improveWithSuggestions": "根据建议改进",
|
||
"regenerateWithFeedback": "使用验证反馈重新生成图表"
|
||
},
|
||
"modelConfig": {
|
||
"title": "AI 模型配置",
|
||
"description": "配置多个 AI 提供商和模型",
|
||
"configure": "配置",
|
||
"addProvider": "添加提供商",
|
||
"addModel": "添加模型",
|
||
"modelId": "模型 ID",
|
||
"modelLabel": "显示名称",
|
||
"streaming": "启用流式输出",
|
||
"deleteProvider": "删除提供商",
|
||
"deleteModel": "删除模型",
|
||
"noModels": "尚未配置模型。添加模型以开始使用。",
|
||
"selectProvider": "选择一个提供商或添加新的",
|
||
"configureMultiple": "配置多个 AI 提供商并轻松切换",
|
||
"apiKeyStored": "API 密钥存储在您的浏览器本地",
|
||
"test": "测试",
|
||
"validationError": "验证失败",
|
||
"addModelFirst": "请先添加至少一个模型以进行验证",
|
||
"providers": "提供商",
|
||
"addProviderHint": "添加提供商即可开始使用",
|
||
"verified": "已验证",
|
||
"configuration": "配置",
|
||
"displayName": "显示名称",
|
||
"awsAccessKeyId": "AWS 访问密钥 ID",
|
||
"awsSecretAccessKey": "AWS Secret Access Key",
|
||
"awsRegion": "AWS 区域",
|
||
"selectRegion": "选择区域",
|
||
"apiKey": "API 密钥",
|
||
"enterApiKey": "输入您的 API 密钥",
|
||
"enterSecretKey": "输入您的 Secret Key",
|
||
"baseUrl": "基础 URL",
|
||
"optional": "(可选)",
|
||
"getApiKey": "获取 API Key",
|
||
"fetchModels": "从服务商获取模型列表",
|
||
"noTools": "不支持工具调用",
|
||
"mayNotDraw": "models.dev 显示这个模型不支持工具调用,可能无法画图。",
|
||
"requestUrl": "请求将发往 {url}",
|
||
"baseUrlWithExample": "基础 URL(可选,例如 {example})",
|
||
"customEndpoint": "自定义端点 URL",
|
||
"minimaxBaseUrlHint": "使用 /anthropic 端点为 Anthropic 兼容 API(推荐),或使用 /v1 端点为 OpenAI 兼容 API",
|
||
"mimoBaseUrlHint": "默认地址适用于按量付费密钥(sk-...)。Token Plan 订阅用户(tp-... 密钥)请设置为 https://token-plan-cn.xiaomimimo.com/v1",
|
||
"models": "模型",
|
||
"customModelId": "自定义模型 ID...",
|
||
"allAdded": "已全部添加",
|
||
"suggested": "推荐",
|
||
"noModelsConfigured": "尚未配置模型",
|
||
"modelIdEmpty": "模型 ID 不能为空",
|
||
"modelIdExists": "此模型 ID 已存在",
|
||
"configureProviders": "配置 AI 提供商",
|
||
"selectProviderHint": "从列表中选择提供商或添加新的以配置 API 密钥和模型",
|
||
"deleteConfirmDesc": "确定要删除 {name} 吗?这将移除所有配置的模型且无法撤销。",
|
||
"typeToConfirm": "输入 \"{name}\" 以确认",
|
||
"typeProviderName": "输入提供商名称...",
|
||
"modelsConfiguredCount": "已配置 {count} 个模型",
|
||
"validationFailedCount": "{count} 个模型验证失败",
|
||
"cancel": "取消",
|
||
"delete": "删除",
|
||
"clickToChange": "(点击更改)",
|
||
"usingServerDefault": "使用服务器默认模型",
|
||
"selectModel": "选择模型",
|
||
"searchModels": "搜索模型...",
|
||
"noVerifiedModels": "没有已验证的模型。请先测试您的模型。",
|
||
"noModelsFound": "未找到模型。",
|
||
"default": "默认",
|
||
"serverDefault": "服务器默认",
|
||
"serverModels": "服务器模型",
|
||
"userModels": "用户模型",
|
||
"configureModels": "配置模型...",
|
||
"onlyVerifiedShown": "仅显示已验证的模型",
|
||
"showUnvalidatedModels": "显示未验证的模型",
|
||
"allModelsShown": "显示所有模型(包括未验证的)",
|
||
"unvalidatedModelWarning": "此模型尚未验证",
|
||
"serverDefaultModel": "服务器默认模型",
|
||
"showValue": "显示值",
|
||
"hideValue": "隐藏值"
|
||
},
|
||
"admin": {
|
||
"title": "管理员设置",
|
||
"loginPrompt": "输入管理员密码(即 ADMIN_PASSWORD 环境变量)以管理服务器设置。",
|
||
"password": "密码",
|
||
"signIn": "登录",
|
||
"signingIn": "正在登录…",
|
||
"loginFailed": "登录失败",
|
||
"precedence": "文件覆盖环境变量 · 环境变量覆盖默认值",
|
||
"notWritable": "此部署环境下设置文件不可写(无服务器平台没有持久化磁盘)。设置以只读方式显示——请改用环境变量进行配置。",
|
||
"settingGroups": "设置分组",
|
||
"enabled": "已启用",
|
||
"disabled": "已禁用",
|
||
"enableGroup": "启用 {group}",
|
||
"unsavedChanges": "有未保存的更改",
|
||
"saved": "设置已保存,更改立即生效。",
|
||
"saveFailed": "保存失败。请检查网络连接后重试。",
|
||
"invalidSettings": "部分设置无效。",
|
||
"discard": "放弃",
|
||
"saveChanges": "保存更改",
|
||
"saving": "正在保存…",
|
||
"sourceSaved": "已保存",
|
||
"sourceEnv": "环境变量",
|
||
"sourceSavedTitle": "在管理员设置文件中设置",
|
||
"sourceEnvTitle": "通过环境变量设置",
|
||
"restartRequired": "需要重启",
|
||
"modified": "已修改",
|
||
"notSet": "未设置",
|
||
"savedReplace": "已保存({hint})——输入以替换",
|
||
"showValue": "显示值",
|
||
"hideValue": "隐藏值",
|
||
"removeValue": "移除值",
|
||
"removeValueTitle": "移除已保存的值",
|
||
"resetToDefault": "恢复默认",
|
||
"models": "模型",
|
||
"modelsDescription": "面向所有用户的服务端 provider 和模型——无需个人 API 密钥。当用户未选择模型时,使用默认 provider 的第一个模型。",
|
||
"addProviderHint": "添加一个 provider,为所有用户提供服务端模型。",
|
||
"selectProviderHint": "选择或添加一个 provider 以配置其凭证和模型。",
|
||
"addProviderToOfferModels": "至少添加一个模型,才能向用户开放此 provider。",
|
||
"managedViaEnv": "(通过环境变量管理)",
|
||
"envReadOnly": "在 AI_MODELS_CONFIG / ai-models.json 中定义——此处只读。请编辑环境配置以更改。",
|
||
"defaultModel": "默认模型",
|
||
"noModelsConfigured": "未配置模型",
|
||
"modelCount": "{count} 个模型",
|
||
"modelCountPlural": "{count} 个模型",
|
||
"default": "默认",
|
||
"setAsDefault": "设为默认 provider",
|
||
"defaultProvider": "默认 provider",
|
||
"modelIdPlaceholder": "模型 ID…",
|
||
"addModel": "添加模型",
|
||
"suggested": "推荐",
|
||
"test": "测试",
|
||
"testOk": "正常({ms} 毫秒)",
|
||
"testFailed": "失败",
|
||
"removeModel": "移除 {model}",
|
||
"deleteProviderTitle": "删除 {name}?",
|
||
"deleteProviderDesc": "保存后,其凭证和模型将从服务器上移除。",
|
||
"cancel": "取消",
|
||
"delete": "删除",
|
||
"groups": {
|
||
"generation": {
|
||
"title": "生成",
|
||
"description": "应用于所有聊天请求的输出参数。"
|
||
},
|
||
"access": {
|
||
"title": "访问控制",
|
||
"description": "限制谁可以使用此部署。"
|
||
},
|
||
"features": {
|
||
"title": "功能",
|
||
"description": "可选功能和安全开关。"
|
||
},
|
||
"observability": {
|
||
"title": "可观测性",
|
||
"description": "对 LLM 调用进行 Langfuse 追踪。"
|
||
},
|
||
"quota": {
|
||
"title": "配额与速率限制",
|
||
"description": "按 IP 的用量限制。强制执行需要 DynamoDB 表。"
|
||
}
|
||
},
|
||
"settings": {
|
||
"TEMPERATURE": {
|
||
"label": "温度",
|
||
"description": "对于拒绝温度参数的推理模型,请留空。"
|
||
},
|
||
"MAX_OUTPUT_TOKENS": {
|
||
"label": "最大输出 token 数"
|
||
},
|
||
"ACCESS_CODE_LIST": {
|
||
"label": "访问码",
|
||
"description": "以逗号分隔的列表。用户需输入其中之一才能聊天。留空 = 开放访问。"
|
||
},
|
||
"ENABLE_VLM_VALIDATION": {
|
||
"label": "VLM 图表验证",
|
||
"description": "使用视觉模型对生成的图表进行可视化验证。"
|
||
},
|
||
"VALIDATION_MODEL": {
|
||
"label": "验证模型",
|
||
"description": "留空时回退到默认 AI 模型。"
|
||
},
|
||
"VALIDATION_TIMEOUT": {
|
||
"label": "验证超时(毫秒)"
|
||
},
|
||
"ENABLE_HISTORY_XML_REPLACE": {
|
||
"label": "历史 XML 压缩",
|
||
"description": "用占位符替换历史记录中的旧图表 XML。"
|
||
},
|
||
"ALLOW_PRIVATE_URLS": {
|
||
"label": "允许私有 URL",
|
||
"description": "关闭以阻止对私有 IP 和内部主机名的请求(SSRF 防护)。"
|
||
},
|
||
"LANGFUSE_PUBLIC_KEY": {
|
||
"label": "Langfuse Public Key"
|
||
},
|
||
"LANGFUSE_SECRET_KEY": {
|
||
"label": "Langfuse Secret Key"
|
||
},
|
||
"LANGFUSE_BASEURL": {
|
||
"label": "Langfuse Base URL"
|
||
},
|
||
"DAILY_REQUEST_LIMIT": {
|
||
"label": "每日请求上限",
|
||
"description": "每个 IP 每天。"
|
||
},
|
||
"DAILY_TOKEN_LIMIT": {
|
||
"label": "每日 token 上限",
|
||
"description": "每个 IP 每天。"
|
||
},
|
||
"TPM_LIMIT": {
|
||
"label": "每分钟 token 数"
|
||
},
|
||
"DYNAMODB_QUOTA_TABLE": {
|
||
"label": "DynamoDB 表",
|
||
"description": "留空时配额强制执行被禁用。"
|
||
},
|
||
"DYNAMODB_REGION": {
|
||
"label": "DynamoDB 区域"
|
||
},
|
||
"QUOTA_TIMEZONE": {
|
||
"label": "配额时区",
|
||
"description": "每日重置边界所用的时区。"
|
||
}
|
||
}
|
||
}
|
||
}
|