list suggestions

This commit is contained in:
Bastian Wagner
2026-06-15 14:42:58 +02:00
parent b979a3b097
commit 3998923693
10 changed files with 204 additions and 100 deletions

View File

@@ -41,6 +41,11 @@ export interface ListItemSuggestionsResponse {
suggestions: ListItemSuggestion[];
}
export interface CreateListWithItemSuggestionsResponse {
list: UserList;
suggestions: ListItemSuggestion[];
}
interface MistralAgentCompletionResponse {
choices?: Array<{
message?: {
@@ -109,6 +114,21 @@ export class ListsService {
return userList;
}
async createListWithItemSuggestions(
ownerId: string,
createDto: CreateListDto,
): Promise<CreateListWithItemSuggestionsResponse> {
const list = await this.createList(ownerId, createDto);
const listEntity = await this.findAccessibleList(ownerId, list.id);
const response = await this.callMistralForItemSuggestions(listEntity);
const suggestions = this.normalizeItemSuggestions(response, listEntity.items);
return {
list,
suggestions,
};
}
async createListFromTemplate(
ownerId: string,
template: ListTemplate,