list suggestions
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user