Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: Message => str (#25876)

crazywoola878420463cda
diff --git a/api/controllers/web/message.py b/api/controllers/web/message.py
index 26c0b133d94..a52cccac133 100644
--- a/api/controllers/web/message.py
+++ b/api/controllers/web/message.py
@@ -261,6 +261,8 @@ class MessageSuggestedQuestionApi(WebApiResource):
questions = MessageService.get_suggested_questions_after_answer(
app_model=app_model, user=end_user, message_id=message_id, invoke_from=InvokeFrom.WEB_APP
)
+ # questions is a list of strings, not a list of Message objects
+ # so we can directly return it
except MessageNotExistsError:
raise NotFound("Message not found")
except ConversationNotExistsError:
diff --git a/api/services/message_service.py b/api/services/message_service.py
index 5df80b7aa32..5e356bf9258 100644
--- a/api/services/message_service.py
+++ b/api/services/message_service.py
@@ -217,7 +217,7 @@ class MessageService:
@classmethod
def get_suggested_questions_after_answer(
cls, app_model: App, user: Union[Account, EndUser] | None, message_id: str, invoke_from: InvokeFrom
- ) -> list[Message]:
+ ) -> list[str]:
if not user:
raise ValueError("user cannot be None")
@@ -288,7 +288,7 @@ class MessageService:
)
with measure_time() as timer:
- questions: list[Message] = LLMGenerator.generate_suggested_questions_after_answer(
+ questions: list[str] = LLMGenerator.generate_suggested_questions_after_answer(
tenant_id=app_model.tenant_id, histories=histories
)