Spaces:
Running
Running
Update app.py
Browse filesfiles cmd displays up to 5 .txt (log) files
app.py
CHANGED
|
@@ -172,7 +172,7 @@ def chat(prompt, user_window, pwd_window, past, response, gptModel):
|
|
| 172 |
isBoss = True
|
| 173 |
if prompt == 'stats':
|
| 174 |
response = genUsageStats()
|
| 175 |
-
list_permanent_files()
|
| 176 |
return [past, response, None, gptModel]
|
| 177 |
if prompt == 'reset':
|
| 178 |
response = genUsageStats(True)
|
|
@@ -186,8 +186,8 @@ def chat(prompt, user_window, pwd_window, past, response, gptModel):
|
|
| 186 |
final_clean_up(user)
|
| 187 |
return [past, response, None, gptModel]
|
| 188 |
if prompt.startswith('files'):
|
| 189 |
-
(log_cnt, wav_cnt, other_cnt, others) = list_permanent_files()
|
| 190 |
-
response = f'{log_cnt} log files\n{wav_cnt} .wav files\n{other_cnt} Other files:\n{others}'
|
| 191 |
return [past, response, None, gptModel]
|
| 192 |
if user_window in unames and pwd_window == pwdList[unames.index(user_window)]:
|
| 193 |
past.append({"role":"user", "content":prompt})
|
|
@@ -308,15 +308,19 @@ def list_permanent_files():
|
|
| 308 |
log_cnt = 0
|
| 309 |
wav_cnt = 0
|
| 310 |
other_cnt = 0
|
|
|
|
| 311 |
for fpath in flist:
|
| 312 |
if fpath.endswith('.txt'):
|
| 313 |
log_cnt += 1
|
|
|
|
| 314 |
elif fpath.endswith('.wav'):
|
| 315 |
wav_cnt += 1
|
| 316 |
else:
|
| 317 |
others.append(fpath)
|
| 318 |
other_cnt = len(others)
|
| 319 |
-
|
|
|
|
|
|
|
| 320 |
|
| 321 |
def make_image(prompt, user, pwd):
|
| 322 |
user = user.lower().strip()
|
|
|
|
| 172 |
isBoss = True
|
| 173 |
if prompt == 'stats':
|
| 174 |
response = genUsageStats()
|
| 175 |
+
# list_permanent_files()
|
| 176 |
return [past, response, None, gptModel]
|
| 177 |
if prompt == 'reset':
|
| 178 |
response = genUsageStats(True)
|
|
|
|
| 186 |
final_clean_up(user)
|
| 187 |
return [past, response, None, gptModel]
|
| 188 |
if prompt.startswith('files'):
|
| 189 |
+
(log_cnt, wav_cnt, other_cnt, others, log_list) = list_permanent_files()
|
| 190 |
+
response = f'{log_cnt} log files\n{wav_cnt} .wav files\n{other_cnt} Other files:\n{others}\nlogs: {str(log_list)}'
|
| 191 |
return [past, response, None, gptModel]
|
| 192 |
if user_window in unames and pwd_window == pwdList[unames.index(user_window)]:
|
| 193 |
past.append({"role":"user", "content":prompt})
|
|
|
|
| 308 |
log_cnt = 0
|
| 309 |
wav_cnt = 0
|
| 310 |
other_cnt = 0
|
| 311 |
+
list_logs = []
|
| 312 |
for fpath in flist:
|
| 313 |
if fpath.endswith('.txt'):
|
| 314 |
log_cnt += 1
|
| 315 |
+
list_logs.append(fpath)
|
| 316 |
elif fpath.endswith('.wav'):
|
| 317 |
wav_cnt += 1
|
| 318 |
else:
|
| 319 |
others.append(fpath)
|
| 320 |
other_cnt = len(others)
|
| 321 |
+
if log_cnt > 5:
|
| 322 |
+
list_logs = []
|
| 323 |
+
return (str(log_cnt), str(wav_cnt), str(other_cnt), str(others), list_logs)
|
| 324 |
|
| 325 |
def make_image(prompt, user, pwd):
|
| 326 |
user = user.lower().strip()
|