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
dae35034
Commit
dae35034
authored
Jan 22, 2026
by
Kantz
Browse files
more testing
parent
ef617e1d
Changes
8
Hide whitespace changes
Inline
Side-by-side
math-tutor/backend/app/api/canvas.py
View file @
dae35034
...
...
@@ -67,7 +67,7 @@ def save_canvas(request: CanvasSaveRequest) -> CanvasSaveResponse:
with
file_path
.
open
(
"wb"
)
as
handle
:
handle
.
write
(
raw
)
latex
=
"
\\
frac{a}{b}"
latex
=
"
\\
frac{a}{b}"
# Placeholder
if
mathpix_client
:
try
:
image
=
mathpix_client
.
image_new
(
str
(
file_path
))
...
...
math-tutor/backend/app/api/retrieval.py
View file @
dae35034
...
...
@@ -39,7 +39,7 @@ class IngestRequest(BaseModel):
class
QueryRequest
(
BaseModel
):
pg_url
:
Optional
[
str
]
=
None
query
:
str
=
Field
(...,
min_length
=
1
)
k
:
int
=
8
k
:
int
=
4
expand_links
:
bool
=
True
section_index
:
Optional
[
int
]
=
None
subsection_index
:
Optional
[
int
]
=
None
...
...
math-tutor/backend/app/services/chat_engine.py
View file @
dae35034
...
...
@@ -19,7 +19,7 @@ Zitiere Quellen inline mit den eckigen Klammern, die im Kontext vorangestellt si
"""
CONTEXT_LIMITS
=
{
"direct"
:
8
,
"direct"
:
4
,
"indirect"
:
6
,
"subsection"
:
2
,
"section"
:
1
,
...
...
math-tutor/backend/app/services/context_store.py
View file @
dae35034
...
...
@@ -14,7 +14,7 @@ _LOG_DIR = os.path.join("logs", "context_sheets")
def
_utc_now
()
->
str
:
return
datetime
.
utc
now
().
strftime
(
"%Y-%m-%dT%H:%M:%SZ"
)
return
datetime
.
now
().
strftime
(
"%Y-%m-%dT%H:%M:%SZ"
)
def
is_new_chat
(
messages
:
list
[
dict
])
->
bool
:
...
...
math-tutor/backend/app/services/orchestrator_engine.py
View file @
dae35034
...
...
@@ -62,12 +62,15 @@ def run_chat(messages: list[dict], draft: str | None = None) -> dict:
_bootstrap_context
(
sheet
,
last_user
.
get
(
"content"
,
""
),
tool_log
)
sheet_text
=
context_store
.
format_sheet
(
sheet
)
reply
=
hint_tool
.
generate_hint
(
task
=
last_user
.
get
(
"content"
,
""
),
solution
=
context_store
.
latest_math_solution
(
sheet
),
history
=
history_text
,
context_sheet
=
sheet_text
,
)
hint_args
=
{
"task"
:
last_user
.
get
(
"content"
,
""
),
"solution"
:
context_store
.
latest_math_solution
(
sheet
),
"history"
:
history_text
,
"context_sheet"
:
sheet_text
,
}
reply
=
hint_tool
.
generate_hint
(
**
hint_args
)
context_store
.
add_tool_output
(
sheet
,
{
"name"
:
"generate_hint"
,
"arguments"
:
hint_args
,
"response"
:
reply
})
_append_tool_log
(
tool_log
,
"generate_hint"
,
hint_args
,
reply
)
if
not
reply
:
reply
=
"Dazu steht nichts im Material"
...
...
math-tutor/backend/app/services/retrieval_service.py
View file @
dae35034
...
...
@@ -20,7 +20,7 @@ SYSTEM_PROMPT = (
)
CONTEXT_LIMITS
=
{
"direct"
:
8
,
"direct"
:
4
,
"indirect"
:
6
,
"subsection"
:
2
,
"section"
:
1
,
...
...
math-tutor/backend/app/services/vector_store.py
View file @
dae35034
...
...
@@ -272,7 +272,7 @@ def retrieve(
pg_url
:
str
,
embedder
:
EmbeddingLike
,
query
:
str
,
k
:
int
=
8
,
k
:
int
=
4
,
section_index
:
Optional
[
int
]
=
None
,
subsection_index
:
Optional
[
int
]
=
None
,
type_filter
:
Optional
[
List
[
str
]]
=
None
,
...
...
math-tutor/backend/app/tools/hint_tool.py
View file @
dae35034
...
...
@@ -9,7 +9,7 @@ def generate_hint(
)
->
str
:
prompt
=
(
"Du bist ein didaktischer Tutor. "
"Gib einen naechsten hilfreichen Hinweis,
aber keine komplett
e L
oe
sung
.
"
"Gib einen naechsten hilfreichen Hinweis,
gib auf keinen Fall ein
e L
ö
sung
aus. Wiederhole nicht den Kontex
"
"Halte dich kurz und klar.
\n\n
"
"Aufgabe:
\n
"
+
task
...
...
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