mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 10:06:17 +08:00
feat(core): add ai model switch ui (#12266)
Close [AI-86](https://linear.app/affine-design/issue/AI-86)  <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced AI model switching in chat, allowing users to select from multiple AI models during conversations. - Added a floating menu for easy AI model selection within the chat interface. - Enabled visibility of the AI model switcher through a new experimental feature flag, configurable in workspace settings (canary builds only). - **Enhancements** - Improved session management in the chat panel for smoother model switching and state handling. - Updated localization to support the new AI model switch feature in settings. - **Bug Fixes** - None. - **Chores** - Registered new components and services to support AI model switching functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// packages/frontend/core/src/blocksuite/ai/hooks/useChatPanelConfig.ts
|
||||
import { AIModelSwitchService } from '@affine/core/modules/ai-button/services/model-switch';
|
||||
import { AINetworkSearchService } from '@affine/core/modules/ai-button/services/network-search';
|
||||
import { AIReasoningService } from '@affine/core/modules/ai-button/services/reasoning';
|
||||
import { CollectionService } from '@affine/core/modules/collection';
|
||||
@@ -21,6 +22,7 @@ export function useAIChatConfig() {
|
||||
|
||||
const searchService = framework.get(AINetworkSearchService);
|
||||
const reasoningService = framework.get(AIReasoningService);
|
||||
const modelSwitchService = framework.get(AIModelSwitchService);
|
||||
const docDisplayMetaService = framework.get(DocDisplayMetaService);
|
||||
const workspaceService = framework.get(WorkspaceService);
|
||||
const searchMenuService = framework.get(SearchMenuService);
|
||||
@@ -40,6 +42,10 @@ export function useAIChatConfig() {
|
||||
setEnabled: reasoningService.setEnabled,
|
||||
};
|
||||
|
||||
const modelSwitchConfig = {
|
||||
visible: modelSwitchService.visible,
|
||||
};
|
||||
|
||||
const docDisplayConfig = {
|
||||
getIcon: (docId: string) => {
|
||||
return docDisplayMetaService.icon$(docId, { type: 'lit' }).value;
|
||||
@@ -124,5 +130,6 @@ export function useAIChatConfig() {
|
||||
reasoningConfig,
|
||||
docDisplayConfig,
|
||||
searchMenuConfig,
|
||||
modelSwitchConfig,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user