Update app.py
Browse files
app.py
CHANGED
@@ -199,8 +199,7 @@ def github_tool(
|
|
199 |
|
200 |
elif action == "create_project_from_template":
|
201 |
if not all([repo_name, template_name]):
|
202 |
-
raise ValueError(
|
203 |
-
"Brakuj膮ce parametry: repo_name, template_name")
|
204 |
if template_name not in PROJECT_TEMPLATES:
|
205 |
raise ValueError(f"Nieznany szablon projektu: {template_name}. Dost臋pne szablony: {', '.join(PROJECT_TEMPLATES.keys())}")
|
206 |
|
@@ -470,13 +469,13 @@ def github_tool(
|
|
470 |
for content in contents:
|
471 |
if content.type == "file":
|
472 |
file_content = get_file_content(owner, repo_name, content.path, branch)
|
473 |
-
analysis = analyze_file_content(file_content, content.path)
|
474 |
file_analyses.append({
|
475 |
"name": content.name,
|
476 |
"path": content.path,
|
477 |
-
"analysis": analysis,
|
478 |
})
|
479 |
-
# Formatowanie wyj艣cia analizy
|
480 |
analysis_md = "Analiza zawarto艣ci plik贸w repozytorium:\n" + "\n".join([
|
481 |
f"- **{f['path']}**:\n"
|
482 |
f" - Liczba linii: {f['analysis']['line_count']}\n"
|
@@ -485,8 +484,6 @@ def github_tool(
|
|
485 |
for f in file_analyses
|
486 |
])
|
487 |
return analysis_md
|
488 |
-
|
489 |
-
|
490 |
else:
|
491 |
raise ValueError(f"Nieznana akcja: {action}")
|
492 |
|
@@ -501,7 +498,7 @@ def github_tool(
|
|
501 |
with gr.Blocks() as demo:
|
502 |
gr.Markdown("# Narz臋dzie GitHub Plugingit (Uproszczony Interfejs)")
|
503 |
|
504 |
-
with gr.Column():
|
505 |
action = gr.Dropdown(
|
506 |
choices=[
|
507 |
"import_repository",
|
@@ -542,7 +539,7 @@ with gr.Blocks() as demo:
|
|
542 |
)
|
543 |
branch = gr.Textbox(label="Ga艂膮藕", value="main")
|
544 |
path = gr.Textbox(label="艢cie偶ka do pliku")
|
545 |
-
content = gr.Code(label="Zawarto艣膰 pliku", lines=5, language='python')
|
546 |
message = gr.Textbox(label="Wiadomo艣膰/Komentarz")
|
547 |
owner = gr.Textbox(label="W艂a艣ciciel")
|
548 |
vcs_url = gr.Textbox(label="URL VCS")
|
@@ -587,4 +584,4 @@ with gr.Blocks() as demo:
|
|
587 |
api_name="github_tool" # API NAME JEST KLUCZOWE!
|
588 |
)
|
589 |
|
590 |
-
demo.launch()
|
|
|
199 |
|
200 |
elif action == "create_project_from_template":
|
201 |
if not all([repo_name, template_name]):
|
202 |
+
raise ValueError("Brakuj膮ce parametry: repo_name, template_name")
|
|
|
203 |
if template_name not in PROJECT_TEMPLATES:
|
204 |
raise ValueError(f"Nieznany szablon projektu: {template_name}. Dost臋pne szablony: {', '.join(PROJECT_TEMPLATES.keys())}")
|
205 |
|
|
|
469 |
for content in contents:
|
470 |
if content.type == "file":
|
471 |
file_content = get_file_content(owner, repo_name, content.path, branch)
|
472 |
+
analysis = analyze_file_content(file_content, content.path)
|
473 |
file_analyses.append({
|
474 |
"name": content.name,
|
475 |
"path": content.path,
|
476 |
+
"analysis": analysis,
|
477 |
})
|
478 |
+
# Formatowanie wyj艣cia analizy
|
479 |
analysis_md = "Analiza zawarto艣ci plik贸w repozytorium:\n" + "\n".join([
|
480 |
f"- **{f['path']}**:\n"
|
481 |
f" - Liczba linii: {f['analysis']['line_count']}\n"
|
|
|
484 |
for f in file_analyses
|
485 |
])
|
486 |
return analysis_md
|
|
|
|
|
487 |
else:
|
488 |
raise ValueError(f"Nieznana akcja: {action}")
|
489 |
|
|
|
498 |
with gr.Blocks() as demo:
|
499 |
gr.Markdown("# Narz臋dzie GitHub Plugingit (Uproszczony Interfejs)")
|
500 |
|
501 |
+
with gr.Column():
|
502 |
action = gr.Dropdown(
|
503 |
choices=[
|
504 |
"import_repository",
|
|
|
539 |
)
|
540 |
branch = gr.Textbox(label="Ga艂膮藕", value="main")
|
541 |
path = gr.Textbox(label="艢cie偶ka do pliku")
|
542 |
+
content = gr.Code(label="Zawarto艣膰 pliku", lines=5, language='python')
|
543 |
message = gr.Textbox(label="Wiadomo艣膰/Komentarz")
|
544 |
owner = gr.Textbox(label="W艂a艣ciciel")
|
545 |
vcs_url = gr.Textbox(label="URL VCS")
|
|
|
584 |
api_name="github_tool" # API NAME JEST KLUCZOWE!
|
585 |
)
|
586 |
|
587 |
+
demo.launch()
|