Skip to content

Commit 742105f

Browse files
authored
fix(desktop): suppress context menu on agent companion pet, reorder AI model config form fields (#697)
- Add onContextMenu preventDefault to AgentCompanionDesktopPet to block native right-click menu - Move auth and API key fields before base URL in AIModelConfig form for better UX
1 parent 12079c6 commit 742105f

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@ export const AgentCompanionDesktopPet: React.FC = () => {
343343
}
344344
}, []);
345345

346+
const onContextMenu = useCallback((event: React.MouseEvent) => {
347+
event.preventDefault();
348+
}, []);
349+
346350
const clearPetPointerSession = (target: HTMLDivElement, pointerId: number) => {
347351
const session = petPointerSessionRef.current;
348352
if (!session || session.pointerId !== pointerId) {
@@ -451,6 +455,7 @@ export const AgentCompanionDesktopPet: React.FC = () => {
451455
return (
452456
<main
453457
className="bitfun-agent-companion-window"
458+
onContextMenu={onContextMenu}
454459
>
455460
<div
456461
ref={dockRef}

src/web-ui/src/infrastructure/config/components/AIModelConfig.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,8 @@ const AIModelConfig: React.FC = () => {
19221922
<ConfigPageRow label={`${t('form.configName')} *`} align="center" wide>
19231923
<Input value={editingConfig.name || ''} onChange={(e) => setEditingConfig(prev => ({ ...prev, name: e.target.value }))} placeholder={t('form.configNamePlaceholder')} inputSize="small" />
19241924
</ConfigPageRow>
1925+
{renderAuthRow()}
1926+
{!authIsCli && renderApiKeyRow(`${t('form.apiKey')} *`)}
19251927
<ConfigPageRow label={`${t('form.baseUrl')} *`} align="center" wide>
19261928
<div className="bitfun-ai-model-config__control-stack">
19271929
<Input
@@ -1952,8 +1954,6 @@ const AIModelConfig: React.FC = () => {
19521954
)}
19531955
</div>
19541956
</ConfigPageRow>
1955-
{renderAuthRow()}
1956-
{!authIsCli && renderApiKeyRow(`${t('form.apiKey')} *`)}
19571957
<ConfigPageRow label={t('form.provider')} align="center" wide>
19581958
<Select value={editingConfig.provider || 'openai'} onChange={(value) => {
19591959
const provider = value as string;

0 commit comments

Comments
 (0)