Skip to content

Extract chat title and sub-thread counting into service methods#680

Merged
Mng-dev-ai merged 1 commit into
mainfrom
refactor/extract-chat-title-and-subthread-logic
Jun 27, 2026
Merged

Extract chat title and sub-thread counting into service methods#680
Mng-dev-ai merged 1 commit into
mainfrom
refactor/extract-chat-title-and-subthread-logic

Conversation

@Mng-dev-ai

Copy link
Copy Markdown
Owner

Summary

  • Extract get_title_source() service method for title generation logic
  • Extract count_sub_threads() service method for sub-thread counting
  • Remove eager-loading of messages in get_chat() (not used by Chat schema)
  • Compute sub_thread_count only in endpoints that need it

Test plan

  • Chat title generation still works (/chat/{id}/generate-title)
  • Chat detail endpoint returns correct sub-thread count
  • Verify message history endpoint works independently

Move title source detection and sub-thread counting into dedicated service
methods for better separation of concerns and improved query efficiency by
avoiding unnecessary message eager-loading.
@Mng-dev-ai Mng-dev-ai marked this pull request as ready for review June 27, 2026 15:55
@Mng-dev-ai Mng-dev-ai merged commit 3f32b66 into main Jun 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant