This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-25
lines changed
app/controllers/discourse_ai/ai_bot
assets/javascripts/initializers Expand file tree Collapse file tree 2 files changed +13
-25
lines changed Original file line number Diff line number Diff line change @@ -10,34 +10,25 @@ def index
1010 page = params [ :page ] &.to_i || 0
1111 per_page = params [ :per_page ] &.to_i || 40
1212
13- # Step 1: Retrieve all AI bot user IDs
1413 bot_user_ids = EntryPoint . all_bot_ids
1514
16- # Step 2: Query for PM topics including current_user and any bot ID
17- #pms =
18- #Topic
19- #.private_messages_for_user(current_user)
20- #.joins(:topic_users)
21- #.where(topic_users: { user_id: bot_user_ids })
22- #.distinct
23- #.order(last_posted_at: :desc)
24- #.offset(page * per_page)
25- #.limit(per_page)
26-
27- #total = Topic
28- #.private_messages_for_user(current_user)
29- #.joins(:topic_users)
30- #.where(topic_users: { user_id: bot_user_ids })
31- #.distinct
32- #.count
33-
3415 pms =
3516 Topic
3617 . private_messages_for_user ( current_user )
18+ . joins ( :topic_users )
19+ . where ( topic_users : { user_id : bot_user_ids } )
20+ . distinct
3721 . order ( last_posted_at : :desc )
3822 . offset ( page * per_page )
3923 . limit ( per_page )
40- total = Topic . private_messages_for_user ( current_user ) . count
24+
25+ total =
26+ Topic
27+ . private_messages_for_user ( current_user )
28+ . joins ( :topic_users )
29+ . where ( topic_users : { user_id : bot_user_ids } )
30+ . distinct
31+ . count
4132
4233 render json : {
4334 conversations : serialize_data ( pms , BasicTopicSerializer ) ,
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ export default {
9292 appEvents . on ( "topic:created" , this , "addNewMessageToSidebar" ) ;
9393 }
9494
95- get name ( ) {
95+ get name ( ) {
9696 return "ai-conversations-history" ;
9797 }
9898
@@ -113,8 +113,6 @@ get name() {
113113 this . watchForTitleUpdate ( topic ) ;
114114 }
115115
116-
117-
118116 @bind
119117 removeScrollListener ( ) {
120118 const sidebar = this . sidebarElement ;
@@ -158,11 +156,10 @@ get name() {
158156 this . isFetching = true ;
159157
160158 ajax ( "/discourse-ai/ai-bot/conversations.json" , {
161- data : { page : this . page , per_page : 20 } ,
159+ data : { page : this . page , per_page : 40 } ,
162160 } )
163161 . then ( ( data ) => {
164162 if ( isLoadingMore ) {
165- // Append to existing topics
166163 this . topics = [ ...this . topics , ...data . conversations ] ;
167164 } else {
168165 this . topics = data . conversations ;
You can’t perform that action at this time.
0 commit comments