feat(core): hide model switch menu (#13070)

Close [AI-307](https://linear.app/affine-design/issue/AI-307)


![image](https://github.com/user-attachments/assets/35ff1261-561c-43d6-91ed-d57cef0a8a41)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Refactor**
* Simplified the preference popup by removing the model selection
submenu and displaying a static model label ("Claude").
* Only the "Extended Thinking" and "Web Search" toggle options remain in
the popup menu.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Wu Yue
2025-07-07 19:18:34 +08:00
committed by GitHub
parent 339bfdae0f
commit ce679af7df
@@ -6,7 +6,6 @@ import {
} from '@blocksuite/affine/components/context-menu'; } from '@blocksuite/affine/components/context-menu';
import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/lit'; import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/lit';
import { import {
AiOutlineIcon,
ArrowDownSmallIcon, ArrowDownSmallIcon,
ThinkingIcon, ThinkingIcon,
WebIcon, WebIcon,
@@ -82,9 +81,9 @@ export class ChatInputPreference extends SignalWatcher(
| undefined; | undefined;
// --------- search props end --------- // --------- search props end ---------
private readonly _onModelChange = (modelId: string) => { // private readonly _onModelChange = (modelId: string) => {
this.onModelChange?.(modelId); // this.onModelChange?.(modelId);
}; // };
openPreference(e: Event) { openPreference(e: Event) {
const element = e.currentTarget; const element = e.currentTarget;
@@ -93,20 +92,20 @@ export class ChatInputPreference extends SignalWatcher(
const searchItems = []; const searchItems = [];
// model switch // model switch
modelItems.push( // modelItems.push(
menu.subMenu({ // menu.subMenu({
name: 'Model', // name: 'Model',
prefix: AiOutlineIcon(), // prefix: AiOutlineIcon(),
options: { // options: {
items: (this.session?.optionalModels ?? []).map(modelId => { // items: (this.session?.optionalModels ?? []).map(modelId => {
return menu.action({ // return menu.action({
name: modelId, // name: modelId,
select: () => this._onModelChange(modelId), // select: () => this._onModelChange(modelId),
}); // });
}), // }),
}, // },
}) // })
); // );
modelItems.push( modelItems.push(
menu.toggleSwitch({ menu.toggleSwitch({
@@ -152,9 +151,7 @@ export class ChatInputPreference extends SignalWatcher(
data-testid="chat-input-preference-trigger" data-testid="chat-input-preference-trigger"
class="chat-input-preference-trigger" class="chat-input-preference-trigger"
> >
<span class="chat-input-preference-trigger-label"> <span class="chat-input-preference-trigger-label"> Claude </span>
${this.modelId || this.session?.model}
</span>
<span class="chat-input-preference-trigger-icon"> <span class="chat-input-preference-trigger-icon">
${ArrowDownSmallIcon()} ${ArrowDownSmallIcon()}
</span> </span>