mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
fix(core): ai history of new users is always loading, enable online search by default (#11741)
Close [AI-69](https://linear.app/affine-design/issue/AI-69).
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
type Signal,
|
||||
} from '@blocksuite/affine/shared/utils';
|
||||
import { LiveData, Service } from '@toeverything/infra';
|
||||
import { map } from 'rxjs';
|
||||
|
||||
import type { FeatureFlagService } from '../../feature-flag';
|
||||
import type { GlobalStateService } from '../../storage';
|
||||
@@ -17,12 +18,18 @@ export class AINetworkSearchService extends Service {
|
||||
super();
|
||||
|
||||
const { signal: enabled, cleanup: enabledCleanup } =
|
||||
createSignalFromObservable<boolean | undefined>(this._enabled$, false);
|
||||
createSignalFromObservable<boolean | undefined>(
|
||||
this._enabled$,
|
||||
undefined
|
||||
);
|
||||
this.enabled = enabled;
|
||||
this.disposables.push(enabledCleanup);
|
||||
|
||||
const { signal: visible, cleanup: visibleCleanup } =
|
||||
createSignalFromObservable<boolean | undefined>(this._visible$, false);
|
||||
createSignalFromObservable<boolean | undefined>(
|
||||
this._visible$,
|
||||
undefined
|
||||
);
|
||||
this.visible = visible;
|
||||
this.disposables.push(visibleCleanup);
|
||||
}
|
||||
@@ -35,8 +42,10 @@ export class AINetworkSearchService extends Service {
|
||||
this.featureFlagService.flags.enable_ai_network_search.$;
|
||||
|
||||
private readonly _enabled$ = LiveData.from(
|
||||
this.globalStateService.globalState.watch<boolean>(AI_NETWORK_SEARCH_KEY),
|
||||
false
|
||||
this.globalStateService.globalState
|
||||
.watch<boolean>(AI_NETWORK_SEARCH_KEY)
|
||||
.pipe(map(v => (v === undefined ? true : v))),
|
||||
undefined
|
||||
);
|
||||
|
||||
setEnabled = (enabled: boolean) => {
|
||||
|
||||
Reference in New Issue
Block a user