PizzAI/frontend/chatgpt_wrap_test.ipynb

84 lines
1.7 KiB
Plaintext
Raw Normal View History

2023-12-04 14:35:35 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from chatgpt_wrap import ChatGPTWrap"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"chatgpt = ChatGPTWrap()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"chatgpt.init_order(\n",
" phone_number = \"123456789\",\n",
" order_items = \"1x margharitta\\n2x sos majonezowy\",\n",
" delivery_address = \"ul. Amogusowa 1337, Suski Małe\",\n",
" payment_method = \"karta\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"try:\n",
" while True:\n",
" message = input(\"You >\")\n",
" print(\"You >\" + message)\n",
"\n",
" if message == \"\":\n",
" break\n",
"\n",
" response = chatgpt.get_response(message)\n",
"\n",
" print(\"ChatGPT >\" + response)\n",
"\n",
" if \"CALLEND\" in response:\n",
" print(\"Conversation ended.\")\n",
" break\n",
"\n",
"except (KeyboardInterrupt, SystemExit):\n",
" exit()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}