mirror of
https://github.com/Paillat-dev/FABLE.git
synced 2026-01-02 01:06:20 +00:00
Added and fixed a whole bunch of things
This commit is contained in:
@@ -5,18 +5,23 @@ from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
openai.api_key = os.getenv("OPENAI_API_KEY")
|
||||
subject = os.getenv("SUBJECT")
|
||||
with open('prompts/ideas.txt') as f:
|
||||
prompt = f.read().replace('[subject]', subject)
|
||||
prompt = f.read()
|
||||
f.close()
|
||||
|
||||
|
||||
async def generate_ideas(path):
|
||||
with open(f'{path}/ideas.json', 'r') as f:
|
||||
ideas = f.read()
|
||||
ides_json = json.loads(ideas)
|
||||
f.close()
|
||||
prmpt = prompt.replace('[existing ideas]', ideas)
|
||||
async def generate_ideas(path, subject):
|
||||
prmpt = prompt.replace('[subject]', subject)
|
||||
try:
|
||||
with open(f'{path}/ideas.json', 'r') as f:
|
||||
ideas = f.read()
|
||||
ides_json = json.loads(ideas)
|
||||
f.close()
|
||||
except:
|
||||
ides_json = []
|
||||
ideas = "There are no existing ideas."
|
||||
prmpt = prmpt.replace('[existing ideas]', ideas)
|
||||
print(prmpt)
|
||||
response = await openai.ChatCompletion.acreate(
|
||||
model="gpt-3.5-turbo",
|
||||
messages=[
|
||||
|
||||
Reference in New Issue
Block a user