GÓWNO
This commit is contained in:
parent
24f909abff
commit
fdfe324f05
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,4 +6,5 @@ frontend/voices/*
|
||||
!frontend/voices/lector.wav
|
||||
!frontend/voices/lector source.txt
|
||||
|
||||
frontend/__pycache__/
|
||||
frontend/__pycache__/
|
||||
frontend/dupa.py
|
||||
|
@ -1,4 +1,13 @@
|
||||
import random
|
||||
from dupa import dupa
|
||||
import openai
|
||||
#
|
||||
#
|
||||
#data = [{
|
||||
# "role": "system",
|
||||
# "content": "You are a bot that will act as a guy that orders a pizza you will be connected on the phone with a pizza place. you will be asked questions about example: Where should be the pizza delivered etc. and you will respond with the data in the data section also you HAVE to respond in a full sentence because it will be transformed into audio using a tts software so you cant use a list just make a sentence like: i would like a margharitta and a cocacola please. basically just write it like you would say it dont put numbers but put words that are numbers dont add shortcuts add the full word\n\nDATA:\nphone: 103 870 844\ndelivery location: ul. Zielona 98/3, Kurwiszynów\npaymentMethod: gotówka\n2x Pizza Prościutto\n3x Pizza Pesto\n3x Lemoniada\n3x Sos Łagodny\n\nREMEMBER DONT USE NUMBERS, USE WORDS for example dont say 1x, say one time also REMEMBER to use replacement words to a word so it is appropriate to the whole sentence example:\nWRONG:\nChciałbym zamówić jedną Margherittę, dwie Colę, pięć Fant i jedną Sprite.\nRIGHT:\nChciałbym zamówić jedną Margarittę, dwie Kole, pięć Fant i jednego Sprajta.\n\nIf the call ends, say at the end of your final response \"CALLEND\"",
|
||||
#}]
|
||||
#while True:
|
||||
|
||||
|
||||
class ChatGPTWrap:
|
||||
@ -9,13 +18,14 @@ class ChatGPTWrap:
|
||||
if not use_chatgpt_placeholder:
|
||||
|
||||
print("Initializing ChatGPT... ", end="")
|
||||
|
||||
with open("system_instructions.txt", "r", encoding="utf-8") as f:
|
||||
self.system_inst_template = f.read()
|
||||
|
||||
|
||||
|
||||
#### true openai chat gpt initialization stuff below (everything that needs to be done only once) ####
|
||||
raise NotImplementedError("True ChatGPT is not implemented yet!")
|
||||
#raise NotImplementedError("True ChatGPT is not implemented yet!")
|
||||
self.client = openai.OpenAI(api_key=dupa)
|
||||
|
||||
|
||||
|
||||
@ -48,15 +58,33 @@ class ChatGPTWrap:
|
||||
#### true openai chat gpt system instructions initialization stuff below ####
|
||||
##### (everything that needs to be done each assistant session like some chat gpt conversation cleanup) ####
|
||||
|
||||
self.chat_history = [{
|
||||
"role": "system",
|
||||
"content": self.system_inst
|
||||
}]
|
||||
|
||||
|
||||
def get_response(self, input_message):
|
||||
# true chatgpt
|
||||
if not self.use_chatgpt_placeholder:
|
||||
#### true openai chat gpt response stuff below ####
|
||||
|
||||
self.chat_history.append(
|
||||
{"role": "user", "content": input_message},
|
||||
)
|
||||
|
||||
chat = self.client.chat.completions.create(
|
||||
model="gpt-3.5-turbo", messages=self.chat_history,
|
||||
stop=["CALLEND"]
|
||||
)
|
||||
|
||||
pass # return response
|
||||
reply = chat.choices[0].message.content
|
||||
|
||||
self.chat_history.append(
|
||||
{"role": "assistant", "content": reply}
|
||||
)
|
||||
|
||||
return reply
|
||||
|
||||
# placeholder chatgpt
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user