mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-09 07:33:30 +00:00
topic summary with ai persona siteSettings
This commit is contained in:
parent
64ad45e28d
commit
1aa727743d
@ -38,7 +38,14 @@ module DiscourseAi
|
||||
input =
|
||||
contents.map { |item| "(#{item[:id]} #{item[:poster]} said: #{item[:text]})" }.join
|
||||
|
||||
prompt = DiscourseAi::Completions::Prompt.new(<<~TEXT, topic_id: target.id)
|
||||
if SiteSetting.ai_summary_consolidator_persona_id
|
||||
prompt =
|
||||
DiscourseAi::Completions::Prompt.new(
|
||||
AiPersona.find_by(id: SiteSetting.ai_summary_consolidator_persona_id).system_prompt,
|
||||
topic_id: target.id,
|
||||
)
|
||||
else
|
||||
prompt = DiscourseAi::Completions::Prompt.new(<<~TEXT, topic_id: target.id) # summary extension prompt
|
||||
You are an advanced summarization bot tasked with enhancing an existing summary by incorporating additional posts.
|
||||
|
||||
### Guidelines:
|
||||
@ -53,6 +60,7 @@ module DiscourseAi
|
||||
- Example: link to the 13th post by joe: [joe](#{resource_path}/13)
|
||||
- When formatting usernames either use @USERNAME or [USERNAME](#{resource_path}/POST_NUMBER)
|
||||
TEXT
|
||||
end
|
||||
|
||||
prompt.push(type: :user, content: <<~TEXT.strip)
|
||||
### Context:
|
||||
@ -81,6 +89,13 @@ module DiscourseAi
|
||||
input =
|
||||
contents.map { |item| "(#{item[:id]} #{item[:poster]} said: #{item[:text]} " }.join
|
||||
|
||||
if SiteSetting.ai_summary_persona_id.present?
|
||||
prompt =
|
||||
DiscourseAi::Completions::Prompt.new(
|
||||
AiPersona.find_by(id: SiteSetting.ai_summary_consolidator_persona_id).system_prompt,
|
||||
topic_id: target.id,
|
||||
)
|
||||
else
|
||||
prompt = DiscourseAi::Completions::Prompt.new(<<~TEXT.strip, topic_id: target.id)
|
||||
You are an advanced summarization bot that generates concise, coherent summaries of provided text.
|
||||
|
||||
@ -95,6 +110,7 @@ module DiscourseAi
|
||||
- Example: link to the 13th post by joe: [joe](#{resource_path}/13)
|
||||
- When formatting usernames either use @USERNMAE OR [USERNAME](#{resource_path}/POST_NUMBER)
|
||||
TEXT
|
||||
end
|
||||
|
||||
prompt.push(
|
||||
type: :user,
|
||||
|
Loading…
x
Reference in New Issue
Block a user