OuroborosM commited on
Commit
af1e847
·
1 Parent(s): ba1c986

update filechecker

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -292,9 +292,9 @@ class GPTRemote(LLM):
292
  try:
293
  # temp = output.split('{')[1].split('}')[0:-2]
294
 
295
- if output.strip()[-1] == '}':
296
  print("valid command")
297
- else:
298
  output = output + '}'
299
  print("corrected command")
300
 
@@ -1427,12 +1427,22 @@ def CheckFileinResp(response):
1427
  try:
1428
  pattern = r'sample-(?:\d{8})-(?:\d{6})\.wav'
1429
  result = re.findall(pattern, response)
1430
- print("result of check file in response:", result)
1431
- Filelist.append(result[-1])
 
1432
 
1433
  except Exception as e:
1434
  print("No wav found:", e)
1435
 
 
 
 
 
 
 
 
 
 
1436
  try:
1437
  listWord = ['(https://example.com/', '(sandbox:/']
1438
  for item in listWord:
@@ -1552,8 +1562,10 @@ def fake(message, history4):
1552
 
1553
  def clearall():
1554
  global memory2
 
1555
  try:
1556
  memory2.clear()
 
1557
  except Exception as e:
1558
  print("memory error:", e)
1559
  # memory_openai.clear()
 
292
  try:
293
  # temp = output.split('{')[1].split('}')[0:-2]
294
 
295
+ if output.strip()[-1] == '}' and 'Action:' in output:
296
  print("valid command")
297
+ elif 'Action:' in output:
298
  output = output + '}'
299
  print("corrected command")
300
 
 
1427
  try:
1428
  pattern = r'sample-(?:\d{8})-(?:\d{6})\.wav'
1429
  result = re.findall(pattern, response)
1430
+ print("wav file in response:", result)
1431
+ for item in result:
1432
+ Filelist.append(item)
1433
 
1434
  except Exception as e:
1435
  print("No wav found:", e)
1436
 
1437
+ try:
1438
+ pattern = r"(?i)'(\w+\.(?:pptx|docx|doc|xlsx|txt|png|jpg))'"
1439
+ result = re.findall(pattern, response)
1440
+ print("Other file in response:", result)
1441
+ for item in result:
1442
+ Filelist.append(item)
1443
+ except Exception as e:
1444
+ print("No other file found:", e)
1445
+
1446
  try:
1447
  listWord = ['(https://example.com/', '(sandbox:/']
1448
  for item in listWord:
 
1562
 
1563
  def clearall():
1564
  global memory2
1565
+ global memory3
1566
  try:
1567
  memory2.clear()
1568
+ memory3.clear()
1569
  except Exception as e:
1570
  print("memory error:", e)
1571
  # memory_openai.clear()