bethanie05 commited on
Commit
f17b795
·
verified ·
1 Parent(s): 667b209

Fix filepaths

Browse files
Files changed (1) hide show
  1. chat_application/main.py +11 -6
chat_application/main.py CHANGED
@@ -3,6 +3,7 @@ from flask_socketio import SocketIO, join_room, leave_room, send
3
  from pymongo import MongoClient
4
  from datetime import datetime, timedelta
5
  import random
 
6
  import time
7
  import math
8
  import os
@@ -27,6 +28,10 @@ CHAT_CONTEXT = 20 #how many messages from chat history to append to inference pr
27
  #minimum number of chars where we start checking for duplicate messages
28
  DUP_LEN = 25 #since short messages may reasonably be the same
29
 
 
 
 
 
30
  app = Flask(__name__)
31
  app.config["SECRET_KEY"] = "supersecretkey"
32
  socketio = SocketIO(app)
@@ -108,24 +113,24 @@ TOPICS_LIST = [
108
  ]
109
 
110
  # FroBot Main Prompt
111
- with open("../data/prompts/frobot_prompt_main.txt") as f:
112
  FROBOT_PROMPT = f.read()
113
  # Instructions
114
- with open("../data/inference_instructions/frobot_instructions_main.txt") as f:
115
  FROBOT_INSTRUCT = f.read()
116
 
117
  # HotBot Prompt
118
- with open("../data/prompts/hotbot_prompt_main.txt") as h:
119
  HOTBOT_PROMPT = h.read()
120
  # Instructions
121
- with open("../data/inference_instructions/hotbot_instructions_main.txt") as h:
122
  HOTBOT_INSTRUCT = h.read()
123
 
124
  # CoolBot Prompt
125
- with open("../data/prompts/coolbot_prompt_main.txt") as c:
126
  COOLBOT_PROMPT = c.read()
127
  # Instructions
128
- with open("../data/inference_instructions/coolbot_instructions_main.txt") as c:
129
  COOLBOT_INSTRUCT = c.read()
130
 
131
  # Randomly select fruits to use for display names
 
3
  from pymongo import MongoClient
4
  from datetime import datetime, timedelta
5
  import random
6
+ from pathlib import Path
7
  import time
8
  import math
9
  import os
 
28
  #minimum number of chars where we start checking for duplicate messages
29
  DUP_LEN = 25 #since short messages may reasonably be the same
30
 
31
+ # Directory alignment
32
+ BASE_DIR = Path(__file__).resolve().parent
33
+ PROJECT_ROOT = BASE_DIR.parent
34
+
35
  app = Flask(__name__)
36
  app.config["SECRET_KEY"] = "supersecretkey"
37
  socketio = SocketIO(app)
 
113
  ]
114
 
115
  # FroBot Main Prompt
116
+ with open(PROJECT_ROOT / "data" / "prompts" / "frobot_prompt_main.txt") as f:
117
  FROBOT_PROMPT = f.read()
118
  # Instructions
119
+ with open(PROJECT_ROOT / "data" / "inference_instructions" / "frobot_instructions_main.txt") as f:
120
  FROBOT_INSTRUCT = f.read()
121
 
122
  # HotBot Prompt
123
+ with open(PROJECT_ROOT / "data" / "prompts" / "hotbot_prompt_main.txt") as h:
124
  HOTBOT_PROMPT = h.read()
125
  # Instructions
126
+ with open(PROJECT_ROOT / "data" / "inference_instructions" / "hotbot_instructions_main.txt") as h:
127
  HOTBOT_INSTRUCT = h.read()
128
 
129
  # CoolBot Prompt
130
+ with open(PROJECT_ROOT / "data" / "prompts" / "coolbot_prompt_main.txt") as c:
131
  COOLBOT_PROMPT = c.read()
132
  # Instructions
133
+ with open(PROJECT_ROOT / "data" / "inference_instructions" / "coolbot_instructions_main.txt") as c:
134
  COOLBOT_INSTRUCT = c.read()
135
 
136
  # Randomly select fruits to use for display names