Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
math_tutor_dev
public_math_tutor
Commits
62f69c7d
Commit
62f69c7d
authored
Jan 26, 2026
by
Kantz
Browse files
kleine anpassung am Toollogger
parent
b903391a
Changes
3
Hide whitespace changes
Inline
Side-by-side
math-tutor/backend/app/LLM_services/decision_LLM.py
View file @
62f69c7d
...
...
@@ -31,7 +31,7 @@ def needs_more_context(history: str, context_sheet: str) -> dict:
payload
=
json
.
loads
(
content
)
return
{
"needs_more_context"
:
bool
(
payload
.
get
(
"needs_more_context"
)),
"reason"
:
payload
.
get
(
"reason"
,
""
),
"reason"
:
content
,
}
except
json
.
JSONDecodeError
:
return
{
"needs_more_context"
:
True
,
"reason"
:
"classifier_parse_error"
}
return
{
"needs_more_context"
:
True
,
"reason"
:
content
}
math-tutor/backend/app/deterministic_services/orchestrator.py
View file @
62f69c7d
...
...
@@ -51,6 +51,7 @@ def run_chat(messages: list[dict], draft: str | None = None) -> dict:
history_text
=
context_store
.
format_history
(
messages
)
sheet_text
=
context_store
.
format_sheet
(
sheet
)
decision
=
decision_LLM
.
needs_more_context
(
history_text
,
sheet_text
)
_append_tool_log
(
tool_log
,
"decision"
,
sheet_text
,
decision
)
context_store
.
add_decision
(
sheet
,
decision
)
if
decision
.
get
(
"needs_more_context"
):
...
...
math-tutor/backend/app/deterministic_services/tool_logging.py
View file @
62f69c7d
...
...
@@ -29,8 +29,17 @@ def write_tool_log(entries: list[dict], created_at: str | None = None, chat_id:
path
=
os
.
path
.
join
(
"logs"
,
f
"tool_calls_
{
suffix
}
_
{
filename_ts
}
.json"
)
payload
=
{
"timestamp"
:
timestamp
,
"entries"
:
entries
,
"entries"
:
list
(
entries
)
,
}
if
os
.
path
.
exists
(
path
):
try
:
with
open
(
path
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
existing
=
json
.
load
(
f
)
if
isinstance
(
existing
,
dict
)
and
isinstance
(
existing
.
get
(
"entries"
),
list
):
payload
[
"entries"
]
=
existing
[
"entries"
]
+
payload
[
"entries"
]
payload
[
"timestamp"
]
=
existing
.
get
(
"timestamp"
,
payload
[
"timestamp"
])
except
(
OSError
,
json
.
JSONDecodeError
):
pass
with
open
(
path
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
json
.
dump
(
payload
,
f
,
ensure_ascii
=
True
,
indent
=
2
)
return
path
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment