mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-14 08:36:22 +08:00
feat: cleanup chat panel (#14258)
#### PR Dependency Tree * **PR #14258** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Removed Features** * Web search functionality has been removed from AI chat and related AI features. Users will no longer see network search options or toggles in chat preferences and panels. * AI chat requests no longer support external web search capabilities. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> #### PR Dependency Tree * **PR #14258** 👈 * **PR #14259** This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal)
This commit is contained in:
@@ -16,7 +16,6 @@ import { AIButtonProvider } from './provider/ai-button';
|
||||
import { AIButtonService } from './services/ai-button';
|
||||
import { AIDraftService } from './services/ai-draft';
|
||||
import { AIModelService } from './services/models';
|
||||
import { AINetworkSearchService } from './services/network-search';
|
||||
import { AIPlaygroundService } from './services/playground';
|
||||
import { AIReasoningService } from './services/reasoning';
|
||||
import { AIToolsConfigService } from './services/tools-config';
|
||||
@@ -27,13 +26,6 @@ export const configureAIButtonModule = (framework: Framework) => {
|
||||
});
|
||||
};
|
||||
|
||||
export function configureAINetworkSearchModule(framework: Framework) {
|
||||
framework.service(AINetworkSearchService, [
|
||||
GlobalStateService,
|
||||
FeatureFlagService,
|
||||
]);
|
||||
}
|
||||
|
||||
export function configureAIReasoningModule(framework: Framework) {
|
||||
framework.service(AIReasoningService, [GlobalStateService]);
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import {
|
||||
createSignalFromObservable,
|
||||
type Signal,
|
||||
} from '@blocksuite/affine/shared/utils';
|
||||
import { LiveData, Service } from '@toeverything/infra';
|
||||
|
||||
import type { FeatureFlagService } from '../../feature-flag';
|
||||
import type { GlobalStateService } from '../../storage';
|
||||
|
||||
const AI_NETWORK_SEARCH_KEY = 'AINetworkSearch';
|
||||
|
||||
export class AINetworkSearchService extends Service {
|
||||
constructor(
|
||||
private readonly globalStateService: GlobalStateService,
|
||||
private readonly featureFlagService: FeatureFlagService
|
||||
) {
|
||||
super();
|
||||
|
||||
const { signal: enabled, cleanup: enabledCleanup } =
|
||||
createSignalFromObservable<boolean | undefined>(
|
||||
this._enabled$,
|
||||
undefined
|
||||
);
|
||||
this.enabled = enabled;
|
||||
this.disposables.push(enabledCleanup);
|
||||
|
||||
const { signal: visible, cleanup: visibleCleanup } =
|
||||
createSignalFromObservable<boolean | undefined>(
|
||||
this._visible$,
|
||||
undefined
|
||||
);
|
||||
this.visible = visible;
|
||||
this.disposables.push(visibleCleanup);
|
||||
}
|
||||
|
||||
visible: Signal<boolean | undefined>;
|
||||
|
||||
enabled: Signal<boolean | undefined>;
|
||||
|
||||
private readonly _visible$ =
|
||||
this.featureFlagService.flags.enable_ai_network_search.$;
|
||||
|
||||
private readonly _enabled$ = LiveData.from(
|
||||
this.globalStateService.globalState.watch<boolean>(AI_NETWORK_SEARCH_KEY),
|
||||
undefined
|
||||
);
|
||||
|
||||
setEnabled = (enabled: boolean) => {
|
||||
this.globalStateService.globalState.set(AI_NETWORK_SEARCH_KEY, enabled);
|
||||
};
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
configureAIButtonModule,
|
||||
configureAIDraftModule,
|
||||
configureAIModelModule,
|
||||
configureAINetworkSearchModule,
|
||||
configureAIPlaygroundModule,
|
||||
configureAIReasoningModule,
|
||||
configureAIToolsConfigModule,
|
||||
@@ -114,7 +113,6 @@ export function configureCommonModules(framework: Framework) {
|
||||
configSearchMenuModule(framework);
|
||||
configureDndModule(framework);
|
||||
configureCommonGlobalStorageImpls(framework);
|
||||
configureAINetworkSearchModule(framework);
|
||||
configureAIReasoningModule(framework);
|
||||
configureAIPlaygroundModule(framework);
|
||||
configureAIButtonModule(framework);
|
||||
|
||||
@@ -24,12 +24,8 @@ export const AIChatBlockPeekView = ({
|
||||
model,
|
||||
host,
|
||||
}: AIChatBlockPeekViewProps) => {
|
||||
const {
|
||||
docDisplayConfig,
|
||||
searchMenuConfig,
|
||||
networkSearchConfig,
|
||||
reasoningConfig,
|
||||
} = useAIChatConfig();
|
||||
const { docDisplayConfig, searchMenuConfig, reasoningConfig } =
|
||||
useAIChatConfig();
|
||||
|
||||
const framework = useFramework();
|
||||
const serverService = framework.get(ServerService);
|
||||
@@ -47,7 +43,6 @@ export const AIChatBlockPeekView = ({
|
||||
host,
|
||||
docDisplayConfig,
|
||||
searchMenuConfig,
|
||||
networkSearchConfig,
|
||||
reasoningConfig,
|
||||
serverService,
|
||||
affineFeatureFlagService,
|
||||
@@ -64,7 +59,6 @@ export const AIChatBlockPeekView = ({
|
||||
host,
|
||||
docDisplayConfig,
|
||||
searchMenuConfig,
|
||||
networkSearchConfig,
|
||||
reasoningConfig,
|
||||
serverService,
|
||||
affineFeatureFlagService,
|
||||
|
||||
Reference in New Issue
Block a user