Przeglądaj źródła

fix: Message => str (#25876)

tags/1.9.0
crazywoola 1 miesiąc temu
rodzic
commit
878420463c
No account linked to committer's email address

+ 2
- 0
api/controllers/web/message.py Wyświetl plik

questions = MessageService.get_suggested_questions_after_answer( questions = MessageService.get_suggested_questions_after_answer(
app_model=app_model, user=end_user, message_id=message_id, invoke_from=InvokeFrom.WEB_APP 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: except MessageNotExistsError:
raise NotFound("Message not found") raise NotFound("Message not found")
except ConversationNotExistsError: except ConversationNotExistsError:

+ 2
- 2
api/services/message_service.py Wyświetl plik

@classmethod @classmethod
def get_suggested_questions_after_answer( def get_suggested_questions_after_answer(
cls, app_model: App, user: Union[Account, EndUser] | None, message_id: str, invoke_from: InvokeFrom cls, app_model: App, user: Union[Account, EndUser] | None, message_id: str, invoke_from: InvokeFrom
) -> list[Message]:
) -> list[str]:
if not user: if not user:
raise ValueError("user cannot be None") raise ValueError("user cannot be None")


) )


with measure_time() as timer: 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 tenant_id=app_model.tenant_id, histories=histories
) )



Ładowanie…
Anuluj
Zapisz