Spaces:
Sleeping
Sleeping
Updates for generating prompt for Leo
Browse files
chat.py
CHANGED
@@ -160,5 +160,19 @@ def initialize_game(game_id, user_id, user_input):
|
|
160 |
save_file(fname, llm_prompt_op.choices[0]["message"]["content"])
|
161 |
return llm_prompt_op.choices[0]["message"]["content"]
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
if __name__ == '__main__':
|
164 |
print("main")
|
|
|
160 |
save_file(fname, llm_prompt_op.choices[0]["message"]["content"])
|
161 |
return llm_prompt_op.choices[0]["message"]["content"]
|
162 |
|
163 |
+
def generate_image_prompt(game_id, user_id, user_input):
|
164 |
+
payload = list()
|
165 |
+
file_data = open_file(f"{file_path}/image_prompt_leo.txt").replace("<<PROMPT_FOR_IMG>>", user_input)
|
166 |
+
leo_input_msg = call_gpt(file_data)
|
167 |
+
leo_input = leo_input_msg.choices[0].message.content
|
168 |
+
timestamp_op = time()
|
169 |
+
timestring_op = timestamp_to_datetime(timestamp_op)
|
170 |
+
vector_op = perform_embedding(leo_input)
|
171 |
+
unique_id_op = str(uuid4)
|
172 |
+
metadata_op = {'speaker': 'BOT4LEO', 'user_id': user_id, 'game_id': game_id, 'timestring': timestring_op, 'text': leo_input}
|
173 |
+
payload.append((unique_id_op, vector_op, metadata_op))
|
174 |
+
|
175 |
+
return leo_input
|
176 |
+
|
177 |
if __name__ == '__main__':
|
178 |
print("main")
|