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
187b5745
Commit
187b5745
authored
Mar 13, 2026
by
Kantz
Browse files
nur noch aufgabe anzeigen die ein Thema haben
parent
3310d9fa
Changes
5
Hide whitespace changes
Inline
Side-by-side
math-tutor/backend/app/api/tasks.py
View file @
187b5745
...
...
@@ -22,6 +22,7 @@ class TaskFile(BaseModel):
title
:
str
intro
:
str
tasks
:
List
[
TaskItem
]
subsections
:
List
[
str
]
=
Field
(
default_factory
=
list
)
class
TasksResponse
(
BaseModel
):
...
...
math-tutor/backend/app/deterministic_services/task_catalog.py
View file @
187b5745
...
...
@@ -259,6 +259,7 @@ def build_task_catalog(task_files: list[dict[str, Any]] | None = None) -> list[d
file_id
=
str
(
task_file
.
get
(
"_file_id"
,
""
))
title
=
str
(
task_file
.
get
(
"title"
,
""
)).
strip
()
intro
=
str
(
task_file
.
get
(
"intro"
,
""
)).
strip
()
subsections
=
task_file
.
get
(
"subsections"
,
[])
tasks
:
list
[
dict
[
str
,
str
]]
=
[]
for
item
in
task_file
.
get
(
"tasks"
,
[]):
if
not
isinstance
(
item
,
dict
):
...
...
@@ -280,6 +281,7 @@ def build_task_catalog(task_files: list[dict[str, Any]] | None = None) -> list[d
"title"
:
title
,
"intro"
:
intro
,
"tasks"
:
tasks
,
"subsections"
:
subsections
,
}
)
return
response
math-tutor/frontend/src/api/taskApi.ts
View file @
187b5745
...
...
@@ -9,6 +9,7 @@ export type TaskFile = {
title
:
string
;
intro
:
string
;
tasks
:
TaskItem
[];
subsections
?:
string
[];
};
export
type
TasksResponse
=
{
...
...
math-tutor/frontend/src/pages/TaskSelectionPage.tsx
View file @
187b5745
...
...
@@ -42,6 +42,16 @@ export default function TaskSelectionPage() {
unlockTask
();
},
[
isTaskModeEnabled
,
isTasksInitialized
,
navigate
,
unlockTask
]);
useEffect
(()
=>
{
if
(
!
taskFileOptions
.
length
)
{
return
;
}
if
(
selectedTaskRef
&&
taskFileOptions
.
some
((
option
)
=>
option
.
value
===
selectedTaskRef
.
fileId
))
{
return
;
}
setTaskFile
(
taskFileOptions
[
0
].
value
);
},
[
isTasksInitialized
,
selectedTaskRef
,
setTaskFile
,
taskFileOptions
]);
useEffect
(()
=>
{
if
(
!
selectedTask
?.
fullText
||
!
taskDisplayRef
.
current
)
{
return
;
...
...
math-tutor/frontend/src/state/tutorSession.tsx
View file @
187b5745
...
...
@@ -65,6 +65,9 @@ export const createSessionId = () =>
export
const
getDefaultTaskId
=
(
tasks
:
Array
<
{
task_id
:
string
}
>
):
string
=>
tasks
.
find
((
task
)
=>
task
.
task_id
===
"
01
"
)?.
task_id
||
tasks
[
0
]?.
task_id
||
""
;
const
isSelectableTaskFile
=
(
file
:
TaskFile
):
boolean
=>
Array
.
isArray
(
file
.
subsections
)
&&
file
.
subsections
.
length
>
0
;
export
function
TutorSessionProvider
({
children
}:
PropsWithChildren
)
{
const
[
chatSessionId
,
setChatSessionId
]
=
useState
<
string
>
(()
=>
createSessionId
());
const
[
selectedOrchestrator
,
setSelectedOrchestratorState
]
=
...
...
@@ -107,13 +110,18 @@ export function TutorSessionProvider({ children }: PropsWithChildren) {
[
selectedTaskRef
?.
fileId
,
taskFiles
]
);
const
selectableTaskFiles
=
useMemo
(
()
=>
taskFiles
.
filter
((
file
)
=>
isSelectableTaskFile
(
file
)),
[
taskFiles
]
);
const
taskFileOptions
=
useMemo
(
()
=>
t
askFiles
.
map
((
file
)
=>
({
selectableT
askFiles
.
map
((
file
)
=>
({
value
:
file
.
file_id
,
label
:
file
.
title
||
file
.
file_id
,
})),
[
t
askFiles
]
[
selectableT
askFiles
]
);
const
taskOptions
=
useMemo
(
...
...
@@ -149,17 +157,18 @@ export function TutorSessionProvider({ children }: PropsWithChildren) {
try
{
const
payload
=
await
fetchTasks
();
const
files
=
payload
.
task_files
||
[];
const
selectableFiles
=
files
.
filter
((
file
)
=>
isSelectableTaskFile
(
file
));
setTaskFiles
(
files
);
setSelectedTaskRef
((
prev
)
=>
{
if
(
prev
)
{
const
file
=
f
iles
.
find
((
item
)
=>
item
.
file_id
===
prev
.
fileId
);
const
file
=
selectableF
iles
.
find
((
item
)
=>
item
.
file_id
===
prev
.
fileId
);
if
(
file
&&
file
.
tasks
.
some
((
task
)
=>
task
.
task_id
===
prev
.
taskId
))
{
return
prev
;
}
}
const
firstFile
=
f
iles
[
0
];
const
firstFile
=
selectableF
iles
[
0
];
if
(
!
firstFile
)
{
return
null
;
}
...
...
@@ -188,7 +197,7 @@ export function TutorSessionProvider({ children }: PropsWithChildren) {
if
(
!
fileId
)
{
return
;
}
const
file
=
taskFiles
.
find
((
item
)
=>
item
.
file_id
===
fileId
);
const
file
=
taskFiles
.
find
((
item
)
=>
item
.
file_id
===
fileId
&&
isSelectableTaskFile
(
item
)
);
if
(
!
file
)
{
return
;
}
...
...
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