feat: Add article messages along with bot responses (#7993)
ref: https://linear.app/chatwoot/issue/CW-2464/bot-should-also-return-links-to-the-information
This commit is contained in:
@@ -8,7 +8,7 @@ class Openai::EmbeddingsService
|
||||
def fetch_embeddings(input)
|
||||
url = 'https://api.openai.com/v1/embeddings'
|
||||
headers = {
|
||||
'Authorization' => "Bearer #{ENV.fetch('OPENAI_API_KEY')}",
|
||||
'Authorization' => "Bearer #{ENV.fetch('OPENAI_API_KEY', '')}",
|
||||
'Content-Type' => 'application/json'
|
||||
}
|
||||
data = {
|
||||
@@ -17,6 +17,6 @@ class Openai::EmbeddingsService
|
||||
}
|
||||
|
||||
response = Net::HTTP.post(URI(url), data.to_json, headers)
|
||||
JSON.parse(response.body)['data'].pick('embedding')
|
||||
JSON.parse(response.body)['data']&.pick('embedding')
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user