mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-17 05:54:29 +08:00
Adds an experimental "Starred" section to the AI bot conversation sidebar. Users can star up to 200 conversations they own; starred items appear in a dedicated section above the time-bucketed list and are skipped from the regular pagination. Introduces: - `discourse_ai_ai_bot_conversation_stars` table and `DiscourseAi::AiBot::ConversationStar` model - `ListConversations` and `UpdateConversationStar` services backing the existing `conversations#index` and a new `PUT /ai-bot/conversations/:topic_id/starred` endpoint - Sidebar context menu component plus updates to the sidebar manager to render and toggle starred state The feature is gated by the hidden, experimental `enable_ai_bot_starred_conversations` upcoming change setting and is off by default. <img width="1216" height="537" alt="image" src="https://github.com/user-attachments/assets/6c7d15bb-8b7c-48d9-9f02-f449764e63ff" /> <img width="955" height="648" alt="image" src="https://github.com/user-attachments/assets/0f87bd8e-e43e-483d-bf68-886cbfb09eea" /> --------- Co-authored-by: discourse-patch-triage[bot] <272280883+discourse-patch-triage[bot]@users.noreply.github.com>
31 lines
907 B
Ruby
31 lines
907 B
Ruby
# frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module TopicExtensions
|
|
extend ActiveSupport::Concern
|
|
|
|
prepended do
|
|
has_many :ai_summaries, as: :target
|
|
|
|
has_one :ai_gist_summary,
|
|
-> { where(summary_type: AiSummary.summary_types[:gist]) },
|
|
class_name: "AiSummary",
|
|
as: :target
|
|
|
|
has_many :inferred_concept_topics
|
|
has_many :inferred_concepts, through: :inferred_concept_topics
|
|
|
|
has_many :ai_conversation_stars,
|
|
class_name: "DiscourseAi::AiBot::ConversationStar",
|
|
foreign_key: :topic_id
|
|
|
|
def self.ai_conversation_custom_field_join_sql
|
|
<<~SQL.squish
|
|
INNER JOIN topic_custom_fields tcf ON tcf.topic_id = topics.id
|
|
AND tcf.name = #{connection.quote(DiscourseAi::AiBot::TOPIC_AI_BOT_PM_FIELD)}
|
|
AND tcf.value = 't'
|
|
SQL
|
|
end
|
|
end
|
|
end
|
|
end
|