adowu commited on
Commit
6f91c0b
1 Parent(s): 8a3568a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py CHANGED
@@ -295,6 +295,32 @@ def github_tool(
295
 
296
  except GithubException as e:
297
  return f"Błąd GitHub: {str(e)}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
 
299
  else:
300
  raise ValueError(f"Nieznana akcja: {action}")
@@ -334,6 +360,7 @@ with gr.Blocks() as demo:
334
  "get_repository_info",
335
  "get_file_content",
336
  "analyze_repository_by_url",
 
337
  ],
338
  label="Akcja",
339
  )
 
295
 
296
  except GithubException as e:
297
  return f"Błąd GitHub: {str(e)}"
298
+
299
+ elif action == "analyze_repository_content":
300
+ if not all([owner, repo_name]):
301
+ raise ValueError("Brakujące parametry: owner, repo_name")
302
+
303
+ try:
304
+ repo = g.get_repo(f"{owner}/{repo_name}")
305
+
306
+ # Pobierz listę plików i katalogów
307
+ contents = repo.get_contents("")
308
+ file_analyses = []
309
+
310
+ # Iteruj po liście i pobieraj zawartość plików
311
+ for content in contents:
312
+ if content.type == "file":
313
+ file_content = get_file_content(owner, repo_name, content.path, branch)
314
+ file_analyses.append({
315
+ "name": content.name,
316
+ "path": content.path,
317
+ "content": file_content,
318
+ })
319
+ return file_analyses
320
+
321
+ except GithubException as e:
322
+ return f"Błąd GitHub: {str(e)}"
323
+
324
 
325
  else:
326
  raise ValueError(f"Nieznana akcja: {action}")
 
360
  "get_repository_info",
361
  "get_file_content",
362
  "analyze_repository_by_url",
363
+ "analyze_repository_content", # Nowa akcja
364
  ],
365
  label="Akcja",
366
  )