mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-01-23 04:52:02 -08:00
fix: not loadin initial data
This commit is contained in:
parent
717c1a50d9
commit
df57317aad
1 changed files with 8 additions and 1 deletions
|
|
@ -66,7 +66,7 @@ export class ExternalAPIService implements IExternalAPIService {
|
|||
},
|
||||
};
|
||||
|
||||
// Observable to emit config changes
|
||||
// Observable to emit config changes - will be updated when settings are loaded
|
||||
public defaultConfig$ = new BehaviorSubject<AiAPIConfig>(this.userSettings.defaultConfig);
|
||||
public providers$ = new BehaviorSubject<AIProviderConfig[]>(this.userSettings.providers);
|
||||
|
||||
|
|
@ -74,6 +74,9 @@ export class ExternalAPIService implements IExternalAPIService {
|
|||
* Initialize the external API service
|
||||
*/
|
||||
public async initialize(): Promise<void> {
|
||||
// Load settings from database first
|
||||
this.ensureSettingsLoaded();
|
||||
|
||||
/**
|
||||
* Initialize database connection for API logging
|
||||
*/
|
||||
|
|
@ -91,6 +94,10 @@ export class ExternalAPIService implements IExternalAPIService {
|
|||
const savedSettings = this.databaseService.getSetting('aiSettings');
|
||||
this.userSettings = savedSettings ?? this.userSettings;
|
||||
this.settingsLoaded = true;
|
||||
|
||||
// Update Observables with loaded settings
|
||||
this.defaultConfig$.next(this.userSettings.defaultConfig);
|
||||
this.providers$.next(this.userSettings.providers);
|
||||
}
|
||||
|
||||
private ensureSettingsLoaded(): void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue