fix: message list order (#3987)

Fix message list order

The system message should be inserted into the first position of the message list instead of being appended at the last position.
This commit is contained in:
sa411022 2024-10-03 03:06:48 +08:00 committed by GitHub
commit 0fc4c4781e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -166,7 +166,7 @@ class LCModelComponent(Component):
messages.append(HumanMessage(content=input_value))
if system_message and not system_message_added:
messages.append(SystemMessage(content=system_message))
messages.insert(0, SystemMessage(content=system_message))
inputs: list | dict = messages or {}
try:
if self.output_parser is not None: