EditChannel.js
46.1 KB
-
🐛 fix: multi-key channel sync and Vertex-AI key-upload edge cases · 3425b6ebBackend 1. controller/channel.go • Always hydrate `ChannelInfo` from DB in `UpdateChannel`, keeping `IsMultiKey` true so `MultiKeySize` is recalculated. 2. model/channel.go • getKeys(): accept both newline-separated keys and JSON array (`[ {...}, {...} ]`). • Update(): reuse new parser-logic to recalc `MultiKeySize`; prune stale indices in `MultiKeyStatusList`. Frontend 1. pages/Channel/EditChannel.js • `handleVertexUploadChange` – Reset `vertexErroredNames` on every change so the “ignored files” prompt always re-appears. – In single-key mode keep only the last file; in batch mode keep all valid files. – Parse files, display “以下文件解析失败,已忽略:…”. • Batch-toggle checkbox – When switching from batch→single while multiple files are present, show a confirm dialog and retain only the first file (synchronises state, form and local caches). • On opening the “new channel” side-sheet, clear `vertexErroredNames` to restore error prompts. Result • “已启用 x/x” count updates immediately after editing multi-key channels. • Vertex-AI key upload works intuitively: proper error feedback, no duplicated files, and safe down-switch from batch to single mode.t0ng7u committed