mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
o
This commit is contained in:
parent
4916c9f9ef
commit
56e95b78f5
2 changed files with 5 additions and 3 deletions
|
@ -14,6 +14,8 @@ ENV INSTANCE_NAME=searxng \
|
|||
BASE_URL= \
|
||||
MORTY_KEY= \
|
||||
MORTY_URL= \
|
||||
GPTKEY= \
|
||||
GPTORG= \
|
||||
SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml \
|
||||
UWSGI_SETTINGS_PATH=/etc/searxng/uwsgi.ini
|
||||
|
||||
|
|
|
@ -716,9 +716,9 @@ def search():
|
|||
gpt = ""
|
||||
gpt_url = "https://api.openai.com/v1/engines/text-davinci-003/completions"
|
||||
gpt_headers = {
|
||||
"Authorization": "Bearer "+os.environ['gptkey'],
|
||||
"Authorization": "Bearer "+os.environ['GPTKEY'],
|
||||
"Content-Type": "application/json",
|
||||
"OpenAI-Organization": os.environ['gptorg']
|
||||
"OpenAI-Organization": os.environ['GPTORG']
|
||||
}
|
||||
gpt_data = {
|
||||
"prompt": prompt,
|
||||
|
@ -736,7 +736,7 @@ def search():
|
|||
gpt_response = requests.post(url, headers=gpt_headers, data=json.dumps(gpt_data))
|
||||
gpt_json = gpt_response.json()
|
||||
if 'choices' in gpt_json:
|
||||
gpt = gpt_json['choices'][0]['text']
|
||||
gpt = gpt_json['choices'][0]['text']
|
||||
for urls in url_pair:
|
||||
gpt.replace(urls.key,urls[urls.key])
|
||||
if gpt and gpt!="":
|
||||
|
|
Loading…
Add table
Reference in a new issue