Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ public ResponseEntity<List<DiscussionResponse>> continueConversation(
.body(discussions.stream().map(conversationApiMapper::map).toList());
}

@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteConversation(@PathVariable UUID id) throws ConversationNotFoundException {
conversationService.getByID(id).orElseThrow(() -> new ConversationNotFoundException(id));
conversationService.delete(id);
return ResponseEntity.status(HttpStatus.OK).body(null);
}

@ExceptionHandler(ConversationNotFoundException.class)
public ResponseEntity<String> handleConversationNotFoundException(
ConversationNotFoundException conversationNotFoundException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Table(name = "conversation")
@Data
public class ConversationEntity extends BaseEntity {
@OneToMany(mappedBy = "conversation")
@OneToMany(mappedBy = "conversation", orphanRemoval = true)
private List<DiscussionEntity> discussions;

@Column(name = "title")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public List<Discussion> askLLMQuestion(UUID id, ConversationRequest conversation
return newDiscussions;
}

public void delete(UUID id) {
conversationPersistenceManager.delete(id);
}

private String getPrediction(String text) {
return llmService.generate(text).toString();
}
Expand Down