I created a website through go daddy: https://bridgeadvisor6.godaddysites.com/.
In the website there is a chatbox, i want to connect this into my gpt store https://chatgpt.com/g/g-YxN0a267E-bridge-advisor. Also add payment system in my website, so people without an GPT account can still search result through my API. Could we do it? thanks
ran this code in python but seemed failed
from flask import Flask, request, jsonify
import openai
app = Flask(__name__)
openai.api_key = 'xxxxx'
@app.route('/chat', methods=['POST'])
def chat_response():
user_input = request.json['message']
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": user_input}]
)
return jsonify({"reply": response['choices'][0]['message']['content']})
if __name__ == '__main__':
app.run()
That’s just a basic example, just to show how to get a simple one time response.
you need to combine messages (each request needs the full chat history and later when the context gets bigger also some kind of summarizing of the older messages in the conversation - there are better concepts but none that works really well depending on what quality you expect - it will either forget or produce an error in longer combination or even forget before that happens because the middle of a prompt… well there is so much to know… you should read a couple thousand forum entries here).
read about system prompt, assistant and user roles…