FEATURE: Support for GPT-4 in AI Helper module (#29)
This commit is contained in:
parent
45950f1bb4
commit
b942a18298
|
@ -36,6 +36,7 @@ en:
|
|||
composer_ai_helper_enabled: "Enable the Composer's AI helper."
|
||||
ai_helper_allowed_groups: "Users on these groups will see the AI helper button in the composer."
|
||||
ai_helper_allowed_in_pm: "Enable the composer's AI helper in PMs."
|
||||
ai_helper_model: "Model to use for the AI helper."
|
||||
|
||||
ai_embeddings_enabled: "Enable the embeddings module."
|
||||
ai_embeddings_discourse_service_api_endpoint: "URL where the API is running for the embeddings module"
|
||||
|
|
|
@ -101,6 +101,12 @@ plugins:
|
|||
ai_helper_allowed_in_pm:
|
||||
default: false
|
||||
client: true
|
||||
ai_helper_model:
|
||||
default: gpt-3.5-turbo
|
||||
type: enum
|
||||
choices:
|
||||
- gpt-3.5-turbo
|
||||
- gpt-4
|
||||
|
||||
ai_embeddings_enabled: false
|
||||
ai_embeddings_discourse_service_api_endpoint: ""
|
||||
|
|
|
@ -5,12 +5,14 @@ module ::DiscourseAi
|
|||
class OpenAiCompletions
|
||||
CompletionFailed = Class.new(StandardError)
|
||||
|
||||
def self.perform!(messages, model = "gpt-3.5-turbo")
|
||||
def self.perform!(messages)
|
||||
headers = {
|
||||
"Authorization" => "Bearer #{SiteSetting.ai_openai_api_key}",
|
||||
"Content-Type" => "application/json",
|
||||
}
|
||||
|
||||
model = SiteSetting.ai_helper_model
|
||||
|
||||
connection_opts = { request: { write_timeout: 60, read_timeout: 60, open_timeout: 60 } }
|
||||
|
||||
response =
|
||||
|
|
Loading…
Reference in New Issue