diff --git a/ChatManager.py b/ChatManager.py
index 675d055..d374eb0 100644
--- a/ChatManager.py
+++ b/ChatManager.py
@@ -33,3 +33,4 @@ def send_prompt(prompt: str) -> str:
input=prompt)
return response.output_text
+
diff --git a/ExecutionEngine.py b/ExecutionEngine.py
index ff4842f..578c05a 100644
--- a/ExecutionEngine.py
+++ b/ExecutionEngine.py
@@ -81,9 +81,11 @@ def check_code_safety(code: str) -> str | None:
BLOCKED_IMPORTS = {
# Filesystem access
- "os", "pathlib", "shutil", "glob", "tempfile", "fileinput",
+ #"os", "pathlib" die beiden wieder reingenommen, da sie in meinen Modulen auftauchen
+ "shutil", "glob", "tempfile", "fileinput",
# Process execution
- "subprocess", "multiprocessing", "threading",
+ #"subprocess" wieder reingenommen, da es in meinem Modul auftaucht
+ "multiprocessing", "threading",
# Network access
"socket", "http", "urllib", "requests", "ftplib", "smtplib",
"xmlrpc", "asyncio",
diff --git a/SystemPrompter.py b/SystemPrompter.py
index 8ce42bc..7eeb873 100644
--- a/SystemPrompter.py
+++ b/SystemPrompter.py
@@ -2,10 +2,35 @@ import streamlit as st
from SearchManager import perform_search, parse_results
-def generate_prompt(user_message: str, file_context=None) -> str:
-# Kontext ist entweder leer oder die angeklickte und geöffnete Datei
+def generate_prompt(user_message: str) -> str:
- system_content = """\
+ if "debug" in st.session_state:
+ system_content = """\
+You are a code-review assistant. You respond with a list of bugs and how to fix them.
+"""
+ task = f"""\
+ {user_message}
+
+ summary: "",
+ for each bug:
+ "severity": "Critical|Medium|Style",
+ "function": "",
+ "description": "",
+ "fix": ""
+ overall_quality: "Poor|Fair|Good|Excellent
+ "
+ """
+
+ context = (f" {st.session_state['file_content']} ")
+ if "code_error" in st.session_state:
+ context += (f" {st.session_state['code_error']} ")
+
+ prompt = system_content + task + context
+ #st.session_state["last_prompt"] = (f"{prompt}")
+ return prompt
+
+ else:
+ system_content = """\
You are an experienced Python coding assistant.
@@ -17,23 +42,23 @@ def generate_prompt(user_message: str, file_context=None) -> str:
"""
- task = (f" {user_message} ")
+ task = (f" {user_message} ")
- context = ""
+ context = ""
- if "internet" in st.session_state:
- context += (f" {parse_results(perform_search(user_message))} ")
+ if "internet" in st.session_state:
+ context += (f" {parse_results(perform_search(user_message))} ")
- if "file_content" in st.session_state:
- context += (f" {st.session_state['file_content']} ")
- else:
- context = ""
- if "code_error" in st.session_state:
- context += (f" {st.session_state['code_error']} ")
+ if "file_content" in st.session_state:
+ context += (f" {st.session_state['file_content']} ")
+
+ if "code_error" in st.session_state:
+ context += (f" {st.session_state['code_error']} ")
- prompt = system_content + task + context
+ prompt = system_content + task + context
- st.session_state["last_prompt"] = (f"{prompt}")
+ #st.session_state["last_prompt"] = (f"{prompt}")
+
+ return prompt
- return prompt
diff --git a/app.py b/app.py
index 9324568..5307380 100644
--- a/app.py
+++ b/app.py
@@ -5,9 +5,13 @@ from FileManager import list_files, read_file, save_file, open_file
from ExecutionEngine import run_code
-"Last sent prompt:",
-if "last_prompt" in st.session_state:
- st.session_state["last_prompt"]
+#"Last sent prompt:",
+#if "last_prompt" in st.session_state:
+# st.session_state["last_prompt"]
+#if "file_content" in st.session_state:
+# st.session_state["file_content"]
+ #type(st.session_state["file_content"])
+ #print(type(st.session_state["file_content"]))
st.set_page_config(layout="wide")
@@ -32,6 +36,7 @@ with col_editor_output:
if st.session_state["selected_file"] != "":
st.button("Save", on_click=save_file, args=[st.session_state["selected_file"], st.session_state["file_content"]])
st.button("Execute Code", on_click=run_code, args=[st.session_state["selected_file"]])
+ #st.button("Debugging mode", on_click=send_debug_message)
# wenn angezigter Code bearbeitet wird, sollte ExecutionEngine aufgerufen werden, diese soll den Code ausführen und im Outputfenster angezeigt werden mit DebugLogger
@@ -67,6 +72,8 @@ with col_chat:
# Input & Response
message = st.chat_input("How can qwen help you?", key="chat")
internet = st.toggle("enable internet search", key="internet")
+ if "code_output" in st.session_state or "code_error" in st.session_state:
+ debug = st.toggle("debug with qwen", key="debug")
if message:
st.session_state.messages.append({"role": "user", "content": message})
response = send_message(message)
diff --git a/example.py b/example.py
index d80e8c7..c48b66e 100644
--- a/example.py
+++ b/example.py
@@ -1,3 +1,6 @@
+
+
print("blabliblu")
print("Hello World")
-print("Hello")
\ No newline at end of file
+print("Hello")
+
diff --git a/example_2.py b/example_2.py
index 3a2afa4..e69de29 100644
--- a/example_2.py
+++ b/example_2.py
@@ -1,11 +0,0 @@
-from argparse import ArgumentParser
-from time import sleep
-
-parser = ArgumentParser()
-parser.add_argument("time", type=int)
-args = parser.parse_args()
-print(f"Starting timer of {args.time} seconds")
-for _ in range(args.time):
- print(".", end="", flush=True)
- sleep(1)
-print("Done!")