FEATURE: add researcher persona (#181)
The researcher persona has access to Google and can perform various internet research tasks. At the moment it can not read web pages, but that is under consideration
This commit is contained in:
parent
3f9973586e
commit
e3abbd9f46
|
@ -107,6 +107,9 @@ en:
|
|||
settings_explorer:
|
||||
name: Settings Explorer
|
||||
description: "AI Bot specialized in helping explore Discourse site settings"
|
||||
researcher:
|
||||
name: Researcher
|
||||
description: "AI Bot with Google access that can research information for you"
|
||||
default_pm_prefix: "[Untitled AI bot PM]"
|
||||
topic_not_found: "Summary unavailable, topic not found!"
|
||||
command_summary:
|
||||
|
|
|
@ -217,12 +217,13 @@ discourse_ai:
|
|||
- time
|
||||
ai_bot_enabled_personas:
|
||||
type: list
|
||||
default: "general|artist|sql_helper|settings_explorer"
|
||||
default: "general|artist|sql_helper|settings_explorer|researcher"
|
||||
choices:
|
||||
- general
|
||||
- artist
|
||||
- sql_helper
|
||||
- settings_explorer
|
||||
- researcher
|
||||
ai_bot_add_to_header:
|
||||
default: true
|
||||
client: true
|
||||
|
|
|
@ -46,6 +46,7 @@ module DiscourseAi
|
|||
require_relative "personas/general"
|
||||
require_relative "personas/sql_helper"
|
||||
require_relative "personas/settings_explorer"
|
||||
require_relative "personas/researcher"
|
||||
end
|
||||
|
||||
def inject_into(plugin)
|
||||
|
|
|
@ -7,6 +7,7 @@ module DiscourseAi
|
|||
personas = [Personas::General, Personas::SqlHelper]
|
||||
personas << Personas::Artist if SiteSetting.ai_stability_api_key.present?
|
||||
personas << Personas::SettingsExplorer
|
||||
personas << Personas::Researcher if SiteSetting.ai_google_custom_search_api_key.present?
|
||||
|
||||
personas_allowed = SiteSetting.ai_bot_enabled_personas.split("|")
|
||||
personas.filter { |persona| personas_allowed.include?(persona.to_s.demodulize.underscore) }
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#frozen_string_literal: true
|
||||
|
||||
module DiscourseAi
|
||||
module AiBot
|
||||
module Personas
|
||||
class Researcher < Persona
|
||||
def commands
|
||||
[Commands::GoogleCommand]
|
||||
end
|
||||
|
||||
def system_prompt
|
||||
<<~PROMPT
|
||||
You are research bot. With access to the internet you can find information for users.
|
||||
|
||||
- You fully understand Discourse Markdown and generate it.
|
||||
- When generating responses you always cite your sources.
|
||||
- When possible you also quote the sources.
|
||||
|
||||
{commands}
|
||||
|
||||
PROMPT
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -64,12 +64,22 @@ module DiscourseAi::AiBot::Personas
|
|||
it "includes all personas by default" do
|
||||
# must be enabled to see it
|
||||
SiteSetting.ai_stability_api_key = "abc"
|
||||
SiteSetting.ai_google_custom_search_api_key = "abc"
|
||||
|
||||
expect(DiscourseAi::AiBot::Personas.all).to contain_exactly(
|
||||
General,
|
||||
SqlHelper,
|
||||
Artist,
|
||||
SettingsExplorer,
|
||||
Researcher,
|
||||
)
|
||||
end
|
||||
|
||||
it "does not include personas that require api keys by default" do
|
||||
expect(DiscourseAi::AiBot::Personas.all).to contain_exactly(
|
||||
General,
|
||||
SqlHelper,
|
||||
SettingsExplorer,
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe DiscourseAi::AiBot::Personas::Researcher do
|
||||
let :researcher do
|
||||
subject
|
||||
end
|
||||
|
||||
it "renders schema" do
|
||||
expect(researcher.commands).to eq([DiscourseAi::AiBot::Commands::GoogleCommand])
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue