Skip to content

Self-hosted AI workspace.

Python

fix(research): avoid double split() call and potential IndexError (#2229)

Wes Huber228dd297386d
diff --git a/src/deep_research.py b/src/deep_research.py
index 375d8d8ab..2045d1c1f 100644
--- a/src/deep_research.py
+++ b/src/deep_research.py
@@ -439,7 +439,8 @@ class DeepResearcher:
)
cat = (result or "").strip().lower()
# Clean one-word answer first.
- first = cat.split()[0].strip(".,\"'*:") if cat.split() else ""
+ parts = cat.split()
+ first = parts[0].strip(".,\"'*:") if parts else ""
if first in CATEGORY_PROMPTS:
return first
# Weak local models often wrap the label in preamble ("the category