This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ def creds_for(provider)
9090
9191 # Open AI
9292 elsif provider == "open_ai"
93- endpoint = fetch_setting ( "ai_openai_embeddings_url" )
93+ endpoint = fetch_setting ( "ai_openai_embeddings_url" ) || "https://api.openai.com/v1/embeddings"
9494 api_key = fetch_setting ( "ai_openai_api_key" )
9595
9696 return if endpoint . blank? || api_key . blank?
Original file line number Diff line number Diff line change 33module DiscourseAi
44 module Embeddings
55 class SemanticRelated
6- MissingEmbeddingError = Class . new ( StandardError )
7-
86 def self . clear_cache_for ( topic )
97 Discourse . cache . delete ( "semantic-suggested-topic-#{ topic . id } " )
108 Discourse . redis . del ( "build-semantic-suggested-topic-#{ topic . id } " )
@@ -26,11 +24,12 @@ def related_topic_ids_for(topic)
2624 # Happens when the topic doesn't have any embeddings
2725 # I'd rather not use Exceptions to control the flow, so this should be refactored soon
2826 if candidate_ids . empty? || !candidate_ids . include? ( topic . id )
29- raise MissingEmbeddingError , "No embeddings found for topic #{ topic . id } "
27+ raise ::DiscourseAi ::Embeddings ::Schema ::MissingEmbeddingError ,
28+ "No embeddings found for topic #{ topic . id } "
3029 end
3130 end
3231 end
33- rescue MissingEmbeddingError
32+ rescue :: DiscourseAi :: Embeddings :: Schema :: MissingEmbeddingError
3433 # avoid a flood of jobs when visiting topic
3534 if Discourse . redis . set (
3635 build_semantic_suggested_key ( topic . id ) ,
You can’t perform that action at this time.
0 commit comments