Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix(lightrag): validate base reasoning directly

NoxsMediad1d265fc491d
diff --git a/web/components/knowledge/LightRagRoleModelsEditor.tsx b/web/components/knowledge/LightRagRoleModelsEditor.tsx
index ab9ee4250..20298b08c 100644
--- a/web/components/knowledge/LightRagRoleModelsEditor.tsx
+++ b/web/components/knowledge/LightRagRoleModelsEditor.tsx
@@ -50,9 +50,18 @@ export function roleModelsValidationError(
option.profile_id === selection?.profile_id &&
option.model_id === selection?.model_id,
);
- if (!findOption(models.base)) {
+ const baseOption = findOption(models.base);
+ if (!baseOption) {
return "The LightRAG base model is unavailable. Choose an accessible model.";
}
+ if (
+ models.base.reasoning_effort &&
+ !baseOption.supported_reasoning_efforts?.includes(
+ models.base.reasoning_effort,
+ )
+ ) {
+ return "The selected reasoning effort is no longer supported.";
+ }
for (const role of ["extract", "keyword", "query", "vlm"] as const) {
const value = models[role];
if (
diff --git a/web/tests/lightrag-role-models.spec.tsx b/web/tests/lightrag-role-models.spec.tsx
index 83ec107ef..a9a64e406 100644
--- a/web/tests/lightrag-role-models.spec.tsx
+++ b/web/tests/lightrag-role-models.spec.tsx
@@ -102,6 +102,9 @@ describe("LightRAG role editor", () => {
...textModel,
reasoning_effort: "high",
});
+ invalidBaseReasoning.extract.reasoning_effort = "none";
+ invalidBaseReasoning.keyword.reasoning_effort = "none";
+ invalidBaseReasoning.query.reasoning_effort = "none";
expect(roleModelsValidationError(invalidBaseReasoning, options)).toBe(
"The selected reasoning effort is no longer supported.",
);