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
8c1db631
Commit
8c1db631
authored
Jun 18, 2026
by
Kantz
Browse files
rename context store new -> task
parent
c58b8046
Changes
11
Hide whitespace changes
Inline
Side-by-side
math-tutor/backend/app/api/chat.py
View file @
8c1db631
...
...
@@ -125,7 +125,7 @@ def bootstrap_socratic(request: SocraticBootstrapRequest) -> SocraticBootstrapRe
chat_id
=
context_store
.
get_chat_id
([],
draft
=
request
.
draft
)
sheet
=
context_store
.
load_sheet
(
chat_id
)
if
not
sheet
:
sheet
=
context_store
.
context_store_
new
.
init_sheet
(
chat_id
,
[])
sheet
=
context_store
.
context_store_
task
.
init_sheet
(
chat_id
,
[])
try
:
topic_entry
=
socratic_oranisator
.
get_topic_entry
(
request
.
topic_key
)
...
...
math-tutor/backend/app/api/context.py
View file @
8c1db631
...
...
@@ -53,5 +53,5 @@ def get_context_solution(request: DraftRequest) -> dict[str, str]:
raise
HTTPException
(
status_code
=
404
,
detail
=
"context sheet not found"
)
return
{
"solution"
:
context_store
.
context_store_
new
.
get_solution
(
sheet
),
"solution"
:
context_store
.
context_store_
task
.
get_solution
(
sheet
),
}
math-tutor/backend/app/api/tasks.py
View file @
8c1db631
...
...
@@ -131,7 +131,7 @@ def select_task(request: SelectTaskRequest) -> SelectTaskResponse:
chat_id
=
context_store
.
get_chat_id
([],
draft
=
request
.
draft
)
sheet
=
context_store
.
load_sheet
(
chat_id
)
if
not
sheet
:
sheet
=
context_store
.
context_store_
new
.
init_sheet
(
chat_id
,
[])
sheet
=
context_store
.
context_store_
task
.
init_sheet
(
chat_id
,
[])
updated
=
task_catalog
.
select_task_by_ids
(
sheet
,
...
...
@@ -155,7 +155,7 @@ def select_topic(request: SelectTopicRequest) -> SelectTopicResponse:
chat_id
=
context_store
.
get_chat_id
([],
draft
=
request
.
draft
)
sheet
=
context_store
.
load_sheet
(
chat_id
)
if
not
sheet
:
sheet
=
context_store
.
context_store_
new
.
init_sheet
(
chat_id
,
[])
sheet
=
context_store
.
context_store_
task
.
init_sheet
(
chat_id
,
[])
try
:
topic_key
=
_set_selected_socratic_topic
(
sheet
,
request
.
topic_key
)
...
...
math-tutor/backend/app/deterministic_services/context_store.py
View file @
8c1db631
...
...
@@ -43,7 +43,7 @@ from app.deterministic_services.context_stores.context_store_open import (
)
# Expose variant modules so callers can opt in explicitly.
from
app.deterministic_services.context_stores
import
context_store_
new
,
context_store_open
from
app.deterministic_services.context_stores
import
context_store_
task
,
context_store_open
__all__
=
[
# shared/base
...
...
@@ -84,5 +84,5 @@ __all__ = [
"get_task"
,
# explicit variants
"context_store_open"
,
"context_store_
new
"
,
"context_store_
task
"
,
]
math-tutor/backend/app/deterministic_services/context_stores/__init__.py
View file @
8c1db631
from
app.deterministic_services.context_stores
import
context_store_base
from
app.deterministic_services.context_stores
import
context_store_
new
from
app.deterministic_services.context_stores
import
context_store_
task
from
app.deterministic_services.context_stores
import
context_store_open
__all__
=
[
"context_store_base"
,
"context_store_open"
,
"context_store_
new
"
]
__all__
=
[
"context_store_base"
,
"context_store_open"
,
"context_store_
task
"
]
math-tutor/backend/app/deterministic_services/context_stores/context_store_open.py
View file @
8c1db631
# Context store for tutor orchestrator.
from
__future__
import
annotations
from
typing
import
Any
...
...
math-tutor/backend/app/deterministic_services/context_stores/context_store_
new
.py
→
math-tutor/backend/app/deterministic_services/context_stores/context_store_
task
.py
View file @
8c1db631
# Context store for tutor orchestrator.
from
__future__
import
annotations
from
typing
import
Any
...
...
math-tutor/backend/app/deterministic_services/orchestrators/orchestrator_socratic.py
View file @
8c1db631
...
...
@@ -97,5 +97,5 @@ def run_chat(
on_bootstrap
=
on_bootstrap
,
on_turn_logic
=
on_turn_logic
,
on_build_reply
=
_on_build_reply
,
init_sheet_fn
=
context_store
.
context_store_
new
.
init_sheet
,
init_sheet_fn
=
context_store
.
context_store_
task
.
init_sheet
,
)
math-tutor/backend/app/deterministic_services/orchestrators/orchestrator_task.py
View file @
8c1db631
...
...
@@ -11,7 +11,7 @@ from app.deterministic_services.orchestrators import orchestrator_base as base
def
_ensure_context_task_fields
(
state
:
base
.
ChatState
,
query_text
:
str
)
->
tuple
[
str
,
str
]
|
None
:
store_new
=
context_store
.
context_store_
new
store_new
=
context_store
.
context_store_
task
has_task
=
bool
(
store_new
.
get_task
(
state
.
sheet
))
has_hints
=
bool
(
store_new
.
get_hints
(
state
.
sheet
))
has_solution
=
bool
(
store_new
.
get_solution
(
state
.
sheet
))
...
...
@@ -87,7 +87,7 @@ def _on_bootstrap(state: base.ChatState, query_text: str) -> None:
source_count
=
_retrieve_context_for_task
(
state
,
query_text
)
if
source_count
>
0
:
_ensure_context_task_fields
(
state
,
query_text
)
task_text
=
context_store
.
context_store_
new
.
get_task
(
state
.
sheet
).
strip
()
task_text
=
context_store
.
context_store_
task
.
get_task
(
state
.
sheet
).
strip
()
retrieval_query
=
query_text
if
task_text
:
retrieval_query
=
f
"Aufgabe:
\n
{
task_text
}
\n\n
{
query_text
}
"
...
...
@@ -101,7 +101,7 @@ def _on_turn_logic(state: base.ChatState) -> None:
# Antwort generieren
def
_on_build_reply
(
state
:
base
.
ChatState
)
->
str
|
None
:
store_new
=
context_store
.
context_store_
new
store_new
=
context_store
.
context_store_
task
history_turns
=
context_store
.
get_history_turns
(
state
.
sheet
)
args
=
{
"query"
:
state
.
last_user
if
not
state
.
new_chat
else
None
,
...
...
@@ -151,5 +151,5 @@ def run_chat(
on_bootstrap
=
on_bootstrap
,
on_turn_logic
=
on_turn_logic
,
on_build_reply
=
_on_build_reply
,
init_sheet_fn
=
context_store
.
context_store_
new
.
init_sheet
,
init_sheet_fn
=
context_store
.
context_store_
task
.
init_sheet
,
)
math-tutor/backend/app/deterministic_services/task_catalog.py
View file @
8c1db631
...
...
@@ -532,7 +532,7 @@ def set_selected_task(
task_entry
:
dict
[
str
,
Any
],
)
->
None
:
task_text
,
hints
,
solution
,
_
=
_build_task_payload
(
task_file
,
task_entry
)
store_new
=
context_store
.
context_store_
new
store_new
=
context_store
.
context_store_
task
store_new
.
set_task
(
sheet
,
task_text
)
store_new
.
set_hints
(
sheet
,
hints
)
store_new
.
set_solution
(
sheet
,
solution
)
...
...
math-tutor/backend/test/task_catalog_socratic_test.py
View file @
8c1db631
...
...
@@ -521,7 +521,7 @@ class TaskApiSocraticTest(unittest.TestCase):
"app.api.tasks.context_store.load_sheet"
,
return_value
=
sheet
,
),
patch
(
"app.api.tasks.context_store.context_store_
new
.init_sheet"
,
"app.api.tasks.context_store.context_store_
task
.init_sheet"
,
return_value
=
sheet
,
),
patch
(
"app.api.tasks.task_catalog.select_topic_by_key"
,
...
...
@@ -558,7 +558,7 @@ class ChatBootstrapSocraticTest(unittest.TestCase):
"app.api.chat.context_store.load_sheet"
,
return_value
=
sheet
,
),
patch
(
"app.api.chat.context_store.context_store_
new
.init_sheet"
,
"app.api.chat.context_store.context_store_
task
.init_sheet"
,
return_value
=
sheet
,
),
patch
(
"app.api.chat.context_store.save_sheet"
...
...
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