Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit c8b6a72

Browse files
committed
Add API scope, for sensitive route
1 parent 621157c commit c8b6a72

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

config/locales/client.en.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ en:
55
scopes:
66
descriptions:
77
discourse_ai:
8-
search: "Allows semantic search via the /discourse-ai/embeddings/semantic-search endpoint."
8+
search: "Allows semantic search"
9+
stream_completion: "Allows streaming ai persona completions"
910

1011
site_settings:
1112
categories:

lib/ai_bot/entry_point.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ def inject_into(plugin)
189189
plugin.register_editable_topic_custom_field(:ai_persona_id)
190190
end
191191

192+
193+
plugin.add_api_key_scope(
194+
:discourse_ai,
195+
{ stream_completion: { actions: %w[discourse_ai/admin/ai_personas#stream_reply] } },
196+
)
197+
192198
plugin.on(:site_setting_changed) do |name, old_value, new_value|
193199
if name == :ai_embeddings_model && SiteSetting.ai_embeddings_enabled? &&
194200
new_value != old_value

0 commit comments

Comments
 (0)