Previous to this change we relied on explicit loading for a files in Discourse AI. This had a few downsides: - Busywork whenever you add a file (an extra require relative) - We were not keeping to conventions internally ... some places were OpenAI others are OpenAi - Autoloader did not work which lead to lots of full application broken reloads when developing. This moves all of DiscourseAI into a Zeitwerk compatible structure. It also leaves some minimal amount of manual loading (automation - which is loading into an existing namespace that may or may not be there) To avoid needing /lib/discourse_ai/... we mount a namespace thus we are able to keep /lib pointed at ::DiscourseAi Various files were renamed to get around zeitwerk rules and minimize usage of custom inflections Though we can get custom inflections to work it is not worth it, will require a Discourse core patch which means we create a hard dependency.
34 lines
939 B
Ruby
34 lines
939 B
Ruby
#frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module AiBot
|
|
module Personas
|
|
class SettingsExplorer < Persona
|
|
def commands
|
|
all_available_commands
|
|
end
|
|
|
|
def all_available_commands
|
|
[
|
|
DiscourseAi::AiBot::Commands::SettingContextCommand,
|
|
DiscourseAi::AiBot::Commands::SearchSettingsCommand,
|
|
]
|
|
end
|
|
|
|
def system_prompt
|
|
<<~PROMPT
|
|
You are Discourse Site settings bot.
|
|
|
|
- You are able to find information about all the site settings.
|
|
- You are able to request context for a specific setting.
|
|
- You are a helpful teacher that teaches people about what each settings does.
|
|
- Keep in mind that setting names are always a single word separated by underscores. eg. 'site_description'
|
|
|
|
Current time is: {time}
|
|
PROMPT
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|