FEATURE: Add creative persona (#231)

This adds a new creative persona that has access to the underlying
model and no external integrations.

It allows people to use Claude/GPT models in a Discourse agnostic
way.
This commit is contained in:
Sam 2023-09-27 01:48:38 +01:00 committed by GitHub
parent 525be42aa5
commit aa463d64f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 1 deletions

View File

@ -113,6 +113,9 @@ en:
researcher: researcher:
name: Researcher name: Researcher
description: "AI Bot with Google access that can research information for you" description: "AI Bot with Google access that can research information for you"
creative:
name: Creative
description: "AI Bot with no external integrations specialized in creative tasks"
default_pm_prefix: "[Untitled AI bot PM]" default_pm_prefix: "[Untitled AI bot PM]"
topic_not_found: "Summary unavailable, topic not found!" topic_not_found: "Summary unavailable, topic not found!"
searching: "Searching for: '%{query}'" searching: "Searching for: '%{query}'"

View File

@ -236,7 +236,7 @@ discourse_ai:
- time - time
ai_bot_enabled_personas: ai_bot_enabled_personas:
type: list type: list
default: "general|artist|sql_helper|settings_explorer|researcher" default: "general|artist|sql_helper|settings_explorer|researcher|creative"
choices: choices:
- general - general
- artist - artist

View File

@ -47,6 +47,7 @@ module DiscourseAi
require_relative "personas/sql_helper" require_relative "personas/sql_helper"
require_relative "personas/settings_explorer" require_relative "personas/settings_explorer"
require_relative "personas/researcher" require_relative "personas/researcher"
require_relative "personas/creative"
end end
def inject_into(plugin) def inject_into(plugin)

View File

@ -0,0 +1,19 @@
#frozen_string_literal: true
module DiscourseAi
module AiBot
module Personas
class Creative < Persona
def commands
[]
end
def system_prompt
<<~PROMPT
You are a helpful bot
PROMPT
end
end
end
end
end

View File

@ -8,6 +8,7 @@ module DiscourseAi
personas << Personas::Artist if SiteSetting.ai_stability_api_key.present? personas << Personas::Artist if SiteSetting.ai_stability_api_key.present?
personas << Personas::SettingsExplorer personas << Personas::SettingsExplorer
personas << Personas::Researcher if SiteSetting.ai_google_custom_search_api_key.present? personas << Personas::Researcher if SiteSetting.ai_google_custom_search_api_key.present?
personas << Personas::Creative
personas_allowed = SiteSetting.ai_bot_enabled_personas.split("|") personas_allowed = SiteSetting.ai_bot_enabled_personas.split("|")
personas.filter { |persona| personas_allowed.include?(persona.to_s.demodulize.underscore) } personas.filter { |persona| personas_allowed.include?(persona.to_s.demodulize.underscore) }

View File

@ -84,6 +84,7 @@ module DiscourseAi::AiBot::Personas
Artist, Artist,
SettingsExplorer, SettingsExplorer,
Researcher, Researcher,
Creative,
) )
end end
@ -92,6 +93,7 @@ module DiscourseAi::AiBot::Personas
General, General,
SqlHelper, SqlHelper,
SettingsExplorer, SettingsExplorer,
Creative,
) )
end end