mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-03-06 17:30:20 +00:00
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."
|
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_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_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_enabled: "Enable the embeddings module."
|
||||||
ai_embeddings_discourse_service_api_endpoint: "URL where the API is running for 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:
|
ai_helper_allowed_in_pm:
|
||||||
default: false
|
default: false
|
||||||
client: true
|
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_enabled: false
|
||||||
ai_embeddings_discourse_service_api_endpoint: ""
|
ai_embeddings_discourse_service_api_endpoint: ""
|
||||||
|
@ -5,12 +5,14 @@ module ::DiscourseAi
|
|||||||
class OpenAiCompletions
|
class OpenAiCompletions
|
||||||
CompletionFailed = Class.new(StandardError)
|
CompletionFailed = Class.new(StandardError)
|
||||||
|
|
||||||
def self.perform!(messages, model = "gpt-3.5-turbo")
|
def self.perform!(messages)
|
||||||
headers = {
|
headers = {
|
||||||
"Authorization" => "Bearer #{SiteSetting.ai_openai_api_key}",
|
"Authorization" => "Bearer #{SiteSetting.ai_openai_api_key}",
|
||||||
"Content-Type" => "application/json",
|
"Content-Type" => "application/json",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model = SiteSetting.ai_helper_model
|
||||||
|
|
||||||
connection_opts = { request: { write_timeout: 60, read_timeout: 60, open_timeout: 60 } }
|
connection_opts = { request: { write_timeout: 60, read_timeout: 60, open_timeout: 60 } }
|
||||||
|
|
||||||
response =
|
response =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user