milestone 4 - integration done
This commit is contained in:
parent
6b07b268c9
commit
0f47f63a18
@ -4,10 +4,11 @@ import subprocess
|
||||
error_log = []
|
||||
|
||||
def log_error(error_message):
|
||||
#if "error_log" not in st.session_state:
|
||||
# st.session_state["log_error"] = ""
|
||||
#if "code_error" in st.session_state:
|
||||
error_log.append(error_message)
|
||||
st.session_state["bugs"] = error_message
|
||||
#if "bugs" not in st.session_state:
|
||||
# st.session_state["bugs"] = ""
|
||||
#if "bugs" in st.session_state:
|
||||
#error_log.append(error_message)
|
||||
|
||||
|
||||
def format_debug_output(output: dict) -> str:
|
||||
|
||||
@ -22,7 +22,7 @@ commentary. Your entire response must be parseable by json.loads().
|
||||
"line": <integer line number or null if not applicable>,
|
||||
"function": "<name of the affected function>",
|
||||
"description": "<what is wrong and why it matters>",
|
||||
"fix": "<one-sentence fix hint>"
|
||||
"fix": "<fix with code snippet>"
|
||||
}}
|
||||
],
|
||||
"overall_quality": "Poor|Fair|Good|Excellent"
|
||||
@ -33,6 +33,8 @@ commentary. Your entire response must be parseable by json.loads().
|
||||
context = (f" <code> {st.session_state['file_content']} </code>")
|
||||
if "code_error" in st.session_state:
|
||||
context += (f" <error> {st.session_state['code_error']} </error>")
|
||||
if "bugs" in st.session_state:
|
||||
context += (f" <bugs> {st.session_state['bugs']} </bugs>")
|
||||
|
||||
prompt = system_content + task + context
|
||||
#st.session_state["last_prompt"] = (f"{prompt}")
|
||||
|
||||
7
app.py
7
app.py
@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from ChatManager import send_message
|
||||
from FileManager import list_files, read_file, save_file, open_file
|
||||
from ExecutionEngine import run_code
|
||||
from DebugLogger import format_debug_output
|
||||
from DebugLogger import format_debug_output, log_error
|
||||
|
||||
|
||||
#"Last sent prompt:",
|
||||
@ -52,7 +52,7 @@ with col_editor_output:
|
||||
|
||||
if "code_error" in st.session_state:
|
||||
st.text_area("Errors", key="code_error")
|
||||
#st.button("Ask qwen?", key="debug", on_click=send_message, args=["Explain this error message and help me debug it"])
|
||||
|
||||
|
||||
|
||||
with col_chat:
|
||||
@ -82,7 +82,8 @@ with col_chat:
|
||||
response = send_message(message)
|
||||
if "debug" in st.session_state and st.session_state["debug"]:
|
||||
response = format_debug_output(json.loads(response))
|
||||
print(response)
|
||||
log_error(response)
|
||||
# st.session_state["bugs"] = response
|
||||
st.session_state.messages.append({"role": "assistant", "content": response})
|
||||
st.rerun()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user