mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
fix(web): warn BYOK users that API mode has no file-edit tools (#2943)
The BYOK chat path streams model text directly through the provider API and does not run the agent-runtime scaffolding that wires up Read/Write/Edit tools — so a model that "decides" to edit a file just emits HTML or code back into the chat. When users switch from Local CLI (Claude Code) to BYOK with an Anthropic key and then ask the agent to keep adjusting a design, nothing on disk changes and the failure mode is silent. Until the BYOK tool loop is implemented (#313 / #699 / #719), surface a clear notice in the BYOK panel of Settings that explains the limitation and points users at Local CLI mode for file edits. Generated-By: looper 0.0.0-dev (runner=worker, agent=claude-code) Co-authored-by: libertecode <libertecode@proton.me>
This commit is contained in:
parent
1aa72b6d09
commit
f4d53486ec
5 changed files with 39 additions and 0 deletions
|
|
@ -2914,6 +2914,13 @@ export function SettingsDialog({
|
|||
<h3>{API_PROTOCOL_LABELS[apiProtocol]}</h3>
|
||||
</div>
|
||||
</div>
|
||||
<p
|
||||
className="settings-test-status warn settings-byok-no-file-tools-notice"
|
||||
role="note"
|
||||
data-testid="settings-byok-no-file-tools-notice"
|
||||
>
|
||||
{t('settings.byokNoFileToolsNotice')}
|
||||
</p>
|
||||
{byokPreconditionNotice ? (
|
||||
<p
|
||||
className="settings-test-status error"
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ export const en: Dict = {
|
|||
'settings.modeDaemonInstalledMeta': '{count} installed',
|
||||
'settings.modeApi': 'API provider',
|
||||
'settings.modeApiMeta': 'BYOK',
|
||||
'settings.byokNoFileToolsNotice':
|
||||
"BYOK mode talks to the model directly and can't read, write, or edit files in your project — the agent will reply with text or HTML instead of applying changes. Switch to Local CLI mode (Claude Code, Codex, …) if you want the agent to edit project files.",
|
||||
'settings.codeAgent': 'Code agent',
|
||||
'settings.codeAgentHint': 'Pick the CLI that runs your prompts.',
|
||||
'settings.rescan': '↻ Rescan',
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ export const zhCN: Dict = {
|
|||
'settings.modeDaemonInstalledMeta': '已安装 {count} 个',
|
||||
'settings.modeApi': 'API 提供方',
|
||||
'settings.modeApiMeta': 'BYOK',
|
||||
'settings.byokNoFileToolsNotice':
|
||||
'BYOK 模式直接与模型对话,无法读取、写入或修改项目中的文件——代理只会以文本或 HTML 回复,不会真正落盘修改。如果需要让代理修改项目文件,请切换到本机 CLI 模式(Claude Code、Codex 等)。',
|
||||
'settings.codeAgent': '代码代理',
|
||||
'settings.codeAgentHint': '选择用来运行提示词的 CLI。',
|
||||
'settings.rescan': '↻ 重新扫描',
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ export interface Dict {
|
|||
'settings.modeDaemonInstalledMeta': string;
|
||||
'settings.modeApi': string;
|
||||
'settings.modeApiMeta': string;
|
||||
'settings.byokNoFileToolsNotice': string;
|
||||
'settings.codeAgent': string;
|
||||
'settings.codeAgentHint': string;
|
||||
'settings.rescan': string;
|
||||
|
|
|
|||
|
|
@ -389,6 +389,33 @@ describe('SettingsDialog execution settings BYOK interactions', () => {
|
|||
).toBe('https://platform.openai.com/api-keys');
|
||||
});
|
||||
|
||||
it('warns BYOK users that API mode cannot edit project files (issue #1106)', () => {
|
||||
// Regression cover: switching from Local CLI to BYOK previously gave no
|
||||
// signal that file-editing tools (`Read`/`Write`/`Edit`) are absent on the
|
||||
// API path. Users typed "continue adjusting the design" expecting edits
|
||||
// and got an HTML monologue back. The notice must be visible on every
|
||||
// BYOK protocol tab so the missing tool surface is discoverable before
|
||||
// the user wastes a turn.
|
||||
renderSettingsDialog();
|
||||
|
||||
const notice = screen.getByTestId('settings-byok-no-file-tools-notice');
|
||||
expect(notice.textContent).toContain('BYOK mode');
|
||||
expect(notice.textContent).toContain("can't read, write, or edit files");
|
||||
expect(notice.textContent).toContain('Local CLI mode');
|
||||
|
||||
fireEvent.click(screen.getByRole('tab', { name: 'OpenAI' }));
|
||||
expect(screen.getByTestId('settings-byok-no-file-tools-notice')).toBeTruthy();
|
||||
|
||||
fireEvent.click(screen.getByRole('tab', { name: 'Google Gemini' }));
|
||||
expect(screen.getByTestId('settings-byok-no-file-tools-notice')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('hides the BYOK no-file-tools notice when Local CLI mode is selected', () => {
|
||||
renderSettingsDialog({ mode: 'daemon' });
|
||||
|
||||
expect(screen.queryByTestId('settings-byok-no-file-tools-notice')).toBeNull();
|
||||
});
|
||||
|
||||
it('lets Anthropic and Google users customize the default base URL', () => {
|
||||
renderSettingsDialog();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue