Skip to content

Commit 4469b35

Browse files
committed
refactor(llamabot): remove unused panel app creation code
- The `create_panel_app` function and its related imports have been removed from `python.py` as they are no longer used. - This change simplifies the module by removing dead code, potentially reducing maintenance overhead and improving readability.
1 parent b7ef263 commit 4469b35

File tree

1 file changed

+0
-89
lines changed

1 file changed

+0
-89
lines changed

llamabot/prompt_library/python.py

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
- tests(code, source_file)
1212
- create_panel_app()
1313
"""
14-
import panel as pn
1514

1615
from llamabot.bot.simplebot import SimpleBot
17-
from llamabot.panel_utils import PanelMarkdownCallbackHandler
1816
from llamabot.prompt_manager import prompt
1917

2018

@@ -144,90 +142,3 @@ def tests(code, source_file_txt: str, dependent_source_files: str):
144142
145143
# noqa: DAR101
146144
"""
147-
148-
149-
def create_panel_app() -> pn.Column:
150-
"""Create a panel app for codebot.
151-
152-
:return: The panel app.
153-
"""
154-
programming_languages = [
155-
"Python",
156-
"Java",
157-
"JavaScript",
158-
"C",
159-
"C++",
160-
"C#",
161-
"Ruby",
162-
"Go",
163-
"Rust",
164-
"Swift",
165-
"Kotlin",
166-
"TypeScript",
167-
"PHP",
168-
"Perl",
169-
"Objective-C",
170-
"Shell",
171-
"SQL",
172-
"HTML",
173-
"CSS",
174-
"R",
175-
"MATLAB",
176-
"Scala",
177-
"Groovy",
178-
"Lua",
179-
"Haskell",
180-
"Elixir",
181-
"Julia",
182-
"Dart",
183-
"VB.NET",
184-
"Assembly",
185-
"F#",
186-
]
187-
language = pn.widgets.Select(name="Select Language", options=programming_languages)
188-
189-
user_specification = pn.widgets.TextAreaInput(
190-
name="User Specification",
191-
placeholder="Please write me a function that generates Fibonacci numbers.",
192-
)
193-
code_output = pn.pane.Markdown()
194-
code_output.object = "_Generated code will show up here._"
195-
test_output = pn.pane.Markdown()
196-
test_output.object = "_Generated unit tests will show up here._"
197-
198-
def generate_code(event):
199-
"""Callback for the code generator button.
200-
201-
:param event: The button click event.
202-
"""
203-
code_output.object = f"```{language.value}\n"
204-
markdown_handler = PanelMarkdownCallbackHandler(code_output)
205-
codebot.model.callbacks.set_handler(markdown_handler)
206-
code_text = codebot(ghostwriter(user_specification.value, language.value))
207-
code_output.object = f"```{language.value}\n{code_text.content}\n```"
208-
209-
def generate_tests(event):
210-
"""Callback for the test generator button.
211-
212-
:param event: The button click event.
213-
"""
214-
test_output.object = f"```{language.value}\n"
215-
markdown_handler = PanelMarkdownCallbackHandler(test_output)
216-
codebot.model.callbacks.set_handler(markdown_handler)
217-
test_text = codebot(tests(code_output.object, language.value))
218-
test_output.object = f"```{language.value}\n{test_text.content}\n```"
219-
220-
generate_button = pn.widgets.Button(name="Generate Code")
221-
generate_button.on_click(generate_code)
222-
223-
test_button = pn.widgets.Button(name="Generate Unit Tests")
224-
test_button.on_click(generate_tests)
225-
226-
return pn.Column(
227-
language,
228-
user_specification,
229-
generate_button,
230-
code_output,
231-
test_button,
232-
test_output,
233-
)

0 commit comments

Comments
 (0)