Suggestions for next steps #1285

Closed
opened 2026-02-21 17:31:52 -05:00 by yindo · 0 comments
Owner

Originally created by @upseem on GitHub (Mar 9, 2024).

Originally assigned to: @crazywoola on GitHub.

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.5.8

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

dify/api/core/prompt/output_parser/suggested_questions_after_answer.py
Can't match the regular pattern

def parse(self, text: str) -> Any:
        json_string = text.strip()
        action_match = re.search(r".*(\[\".+\"\]).*", json_string, re.DOTALL)
        if action_match is not None:
            json_obj = json.loads(action_match.group(1).strip(), strict=False)
        else:
            raise InvokeError("Could not parse LLM output: {text}")

        return json_obj
## It is recommended to change it to the following
def parse(self, text: str) -> Any:
        action_match = re.search(r"\[.*?\]", text.strip(), re.DOTALL)
        if action_match is not None:
            json_obj = json.loads(action_match.group(0).strip())
        else:
            raise InvokeError("Could not parse LLM output: {text}")

        return json_obj

✔️ Expected Behavior

[
"问题1",
"问题2",
"问题3"
]

Actual Behavior

[]

Originally created by @upseem on GitHub (Mar 9, 2024). Originally assigned to: @crazywoola on GitHub. ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Pleas do not modify this template :) and fill in all the required fields. ### Dify version 0.5.8 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce dify/api/core/prompt/output_parser/suggested_questions_after_answer.py Can't match the regular pattern ```python def parse(self, text: str) -> Any: json_string = text.strip() action_match = re.search(r".*(\[\".+\"\]).*", json_string, re.DOTALL) if action_match is not None: json_obj = json.loads(action_match.group(1).strip(), strict=False) else: raise InvokeError("Could not parse LLM output: {text}") return json_obj ## It is recommended to change it to the following def parse(self, text: str) -> Any: action_match = re.search(r"\[.*?\]", text.strip(), re.DOTALL) if action_match is not None: json_obj = json.loads(action_match.group(0).strip()) else: raise InvokeError("Could not parse LLM output: {text}") return json_obj ``` ### ✔️ Expected Behavior [ "问题1", "问题2", "问题3" ] ### ❌ Actual Behavior []
yindo added the 🐞 bug label 2026-02-21 17:31:52 -05:00
yindo closed this issue 2026-02-21 17:31:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1285