mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-06 06:22:19 +00:00
FIX: resource_url replacemente in Persona's system prompt (#1310)
This commit is contained in:
parent
a6fa619c31
commit
48305dc7d3
@ -50,6 +50,7 @@ module DiscourseAi
|
|||||||
@site_description = site_description
|
@site_description = site_description
|
||||||
@time = time
|
@time = time
|
||||||
@feature_name = feature_name
|
@feature_name = feature_name
|
||||||
|
@resource_url = resource_url
|
||||||
|
|
||||||
if post
|
if post
|
||||||
@post_id = post.id
|
@post_id = post.id
|
||||||
|
@ -15,6 +15,7 @@ class TestPersona < DiscourseAi::Personas::Persona
|
|||||||
{site_description}
|
{site_description}
|
||||||
{participants}
|
{participants}
|
||||||
{time}
|
{time}
|
||||||
|
{resource_url}
|
||||||
PROMPT
|
PROMPT
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -35,6 +36,8 @@ RSpec.describe DiscourseAi::Personas::Persona do
|
|||||||
AiPersona.persona_cache.flush!
|
AiPersona.persona_cache.flush!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let(:resource_url) { "https://path-to-resource" }
|
||||||
|
|
||||||
let(:context) do
|
let(:context) do
|
||||||
DiscourseAi::Personas::BotContext.new(
|
DiscourseAi::Personas::BotContext.new(
|
||||||
site_url: Discourse.base_url,
|
site_url: Discourse.base_url,
|
||||||
@ -42,6 +45,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
|
|||||||
site_description: "test site description",
|
site_description: "test site description",
|
||||||
time: Time.zone.now,
|
time: Time.zone.now,
|
||||||
participants: topic_with_users.allowed_users.map(&:username).join(", "),
|
participants: topic_with_users.allowed_users.map(&:username).join(", "),
|
||||||
|
resource_url: resource_url,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -60,6 +64,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
|
|||||||
expect(system_message).to include("test site description")
|
expect(system_message).to include("test site description")
|
||||||
expect(system_message).to include("joe, jane")
|
expect(system_message).to include("joe, jane")
|
||||||
expect(system_message).to include(Time.zone.now.to_s)
|
expect(system_message).to include(Time.zone.now.to_s)
|
||||||
|
expect(system_message).to include(resource_url)
|
||||||
|
|
||||||
tools = rendered.tools
|
tools = rendered.tools
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user