mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-24 23:20:39 +08:00
<img width="1139" height="282" alt="Screenshot 2025-08-12 at 11 22 05 AM" src="https://github.com/user-attachments/assets/5649ea01-1b55-4211-841a-e8c85d1e5972" /> <img width="1102" height="175" alt="Screenshot 2025-08-12 at 11 22 25 AM" src="https://github.com/user-attachments/assets/dabaa2f6-a6cd-4f6d-9aba-ce46056d01a4" />
42 lines
1.2 KiB
Ruby
Vendored
42 lines
1.2 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
RSpec.describe DiscourseAi::Admin::AiFeaturesController do
|
|
let(:controller) { described_class.new }
|
|
fab!(:admin)
|
|
fab!(:group)
|
|
fab!(:llm_model)
|
|
fab!(:summarizer_persona) { Fabricate(:ai_persona) }
|
|
fab!(:alternate_summarizer_persona) { Fabricate(:ai_persona) }
|
|
|
|
before do
|
|
enable_current_plugin
|
|
sign_in(admin)
|
|
assign_fake_provider_to(:ai_default_llm_model)
|
|
SiteSetting.ai_bot_enabled = true
|
|
end
|
|
|
|
describe "#index" do
|
|
it "lists all features backed by personas" do
|
|
get "/admin/plugins/discourse-ai/ai-features.json"
|
|
|
|
expect(response.status).to eq(200)
|
|
expect(response.parsed_body["ai_features"].count).to eq(9)
|
|
end
|
|
|
|
it "includes automation-related features" do
|
|
SiteSetting.discourse_automation_enabled = true
|
|
|
|
get "/admin/plugins/discourse-ai/ai-features.json"
|
|
|
|
expect(response.status).to eq(200)
|
|
expect(response.parsed_body["ai_features"].count).to eq(11)
|
|
end
|
|
end
|
|
|
|
describe "#edit" do
|
|
it "returns a success response" do
|
|
get "/admin/plugins/discourse-ai/ai-features/1/edit.json"
|
|
expect(response.parsed_body["module_name"]).to eq("summarization")
|
|
end
|
|
end
|
|
end
|