Skip to content

Commit

Permalink
new api
Browse files Browse the repository at this point in the history
  • Loading branch information
Dainius Kirsnauskas committed May 28, 2024
1 parent 8160293 commit e0024ed
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions GUI/back-end/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@
# Configurations
cors = CORS(app, origins=origins)


@app.route('/api/v1/request', methods=['POST'])
def process():
request_data = request.get_json()
if not request_data:
return ''

openai.api_key = "sk-proj-FCpUZQtdF7z9gBjMfbgVT3BlbkFJUSgsIUYLbmGrfcZ3SJ4k"

openai.api_key = "sk-proj-eWH61LkiWI5jdiRVrxRhT3BlbkFJAjtKQGoYXwzt2JXaWZMz"
discussions = [{"role": "system", "content": "I guessed number 5"}]
discussions.append({"role": "user", "content": request_data})

response = openai.chat.completions.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": request_data}],
messages=discussions,
)

return response.choices[0].message.content
Expand Down

0 comments on commit e0024ed

Please sign in to comment.