in apps/chat/src/utils/app/data/storages/api-storage.ts [146:214]
name: generateNextName(
DEFAULT_CONVERSATION_NAME,
conversation.name,
conversations,
),
};
return this._conversationApiStorage.createEntity(
regenerateConversationId(updatedConv),
);
}),
switchMap((conversation) => this.getConversation(conversation)),
);
}),
);
}
updateConversation(conversation: Conversation): Observable<void> {
return this._conversationApiStorage.updateEntity(conversation);
}
deleteConversation(info: ConversationInfo): Observable<void> {
return this._conversationApiStorage.deleteEntity(info);
}
setConversations(
conversations: Conversation[],
): Observable<ConversationInfo> {
return from(conversations).pipe(
concatMap((conv) =>
this.getConversations(conv.folderId).pipe(
concatMap((apiConversations) =>
this.tryCreateEntity(
conv,
[...conversations, ...apiConversations],
this._conversationApiStorage,
BackendResourceType.CONVERSATION,
),
),
),
),
);
}
getPromptsAndFolders(path?: string): Observable<FoldersAndEntities<Entity>> {
return this._promptApiStorage.getFoldersAndEntities(path);
}
getPrompts(path?: string, recursive?: boolean): Observable<Prompt[]> {
return this._promptApiStorage.getEntities(path, recursive);
}
getMultipleFoldersPrompts(
paths: string[],
recursive?: boolean,
): Observable<Prompt[]> {
return this._promptApiStorage.getMultipleFoldersEntities(paths, recursive);
}
getPrompt(info: PromptInfo): Observable<Prompt | null> {
return this._promptApiStorage.getEntity(info);
}
createPrompt(prompt: Prompt): Observable<PromptInfo | null> {
return this._promptApiStorage.createEntity(prompt).pipe(
catchError(() => {
return this.getPrompts(prompt.folderId).pipe(
switchMap((prompts) => {
const updatedPrompt = {