syntax tree

This commit is contained in:
Sam Saffron 2024-09-18 10:37:40 +10:00
parent 593abadd37
commit 9d38e51cf5
No known key found for this signature in database
GPG Key ID: B9606168D2FFD9F5
5 changed files with 9 additions and 15 deletions

View File

@ -5,8 +5,7 @@ module DiscourseAi
class AiPersonasController < ::Admin::AdminController class AiPersonasController < ::Admin::AdminController
requires_plugin ::DiscourseAi::PLUGIN_NAME requires_plugin ::DiscourseAi::PLUGIN_NAME
before_action :find_ai_persona, before_action :find_ai_persona, only: %i[show update destroy create_user]
only: %i[show update destroy create_user]
def index def index
ai_personas = ai_personas =
@ -75,7 +74,6 @@ module DiscourseAi
end end
end end
private private
def find_ai_persona def find_ai_persona
@ -133,7 +131,6 @@ module DiscourseAi
end end
end end
end end
end end
end end
end end

View File

@ -70,7 +70,6 @@ module DiscourseAi
) )
end end
end end
end end
end end
end end

View File

@ -72,11 +72,7 @@ class RagDocumentFragment < ActiveRecord::Base
end end
def publish_status(upload, status) def publish_status(upload, status)
MessageBus.publish( MessageBus.publish("/discourse-ai/rag/#{upload.id}", status, user_ids: [upload.user_id])
"/discourse-ai/rag/#{upload.id}",
status,
user_ids: [upload.user_id],
)
end end
end end
end end

View File

@ -58,8 +58,10 @@ Discourse::Application.routes.draw do
put "/ai-personas/:id/files/remove", to: "discourse_ai/admin/ai_personas#remove_file" put "/ai-personas/:id/files/remove", to: "discourse_ai/admin/ai_personas#remove_file"
get "/ai-personas/:id/files/status", to: "discourse_ai/admin/ai_personas#indexing_status_check" get "/ai-personas/:id/files/status", to: "discourse_ai/admin/ai_personas#indexing_status_check"
post "/rag-document-fragments/files/upload", to: "discourse_ai/admin/rag_document_fragments#upload_file" post "/rag-document-fragments/files/upload",
get "/rag-document-fragments/files/status", to: "discourse_ai/admin/rag_document_fragments#indexing_status_check" to: "discourse_ai/admin/rag_document_fragments#upload_file"
get "/rag-document-fragments/files/status",
to: "discourse_ai/admin/rag_document_fragments#indexing_status_check"
resources :ai_llms, resources :ai_llms,
only: %i[index create show update destroy], only: %i[index create show update destroy],

View File

@ -38,9 +38,9 @@ RSpec.describe Jobs::GenerateRagEmbeddings do
describe "Publishing progress updates" do describe "Publishing progress updates" do
it "sends an update through mb after a batch finishes" do it "sends an update through mb after a batch finishes" do
updates = updates =
MessageBus.track_publish( MessageBus.track_publish("/discourse-ai/rag/#{rag_document_fragment_1.upload_id}") do
"/discourse-ai/rag/#{rag_document_fragment_1.upload_id}", subject.execute(fragment_ids: [rag_document_fragment_1.id])
) { subject.execute(fragment_ids: [rag_document_fragment_1.id]) } end
upload_index_stats = updates.last.data upload_index_stats = updates.last.data