🚀 feat(memories.py): add default value for connection_string field in PostgresChatMessageHistoryFrontendNode
The trailing whitespace has been removed for consistency and readability. The unused import of `DEFAULT_CONNECTION_STRING` from `langchain.memory.chat_message_histories.postgres` has been removed. The `PostgresChatMessageHistoryFrontendNode` now has a default value for the `connection_string` field, which is set to `DEFAULT_CONNECTION_STRING`. This ensures that the field has a default value when creating instances of the class.
🔧 chore(memories.py): remove trailing whitespace and unused import
This commit is contained in:
parent
5924aa4442
commit
3845a60bcf
1 changed files with 4 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ from typing import Optional
|
||||||
from langflow.template.field.base import TemplateField
|
from langflow.template.field.base import TemplateField
|
||||||
from langflow.template.frontend_node.base import FrontendNode
|
from langflow.template.frontend_node.base import FrontendNode
|
||||||
from langflow.template.template.base import Template
|
from langflow.template.template.base import Template
|
||||||
|
from langchain.memory.chat_message_histories.postgres import DEFAULT_CONNECTION_STRING
|
||||||
|
|
||||||
|
|
||||||
class MemoryFrontendNode(FrontendNode):
|
class MemoryFrontendNode(FrontendNode):
|
||||||
|
|
@ -10,7 +11,7 @@ class MemoryFrontendNode(FrontendNode):
|
||||||
def add_extra_fields(self) -> None:
|
def add_extra_fields(self) -> None:
|
||||||
# chat history should have another way to add common field?
|
# chat history should have another way to add common field?
|
||||||
# prevent adding incorect field in ChatMessageHistory
|
# prevent adding incorect field in ChatMessageHistory
|
||||||
if "BaseChatMessageHistory" in self.base_classes:
|
if "BaseChatMessageHistory" in self.base_classes:
|
||||||
return
|
return
|
||||||
|
|
||||||
# add return_messages field
|
# add return_messages field
|
||||||
|
|
@ -95,6 +96,7 @@ class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode):
|
||||||
required=True,
|
required=True,
|
||||||
show=True,
|
show=True,
|
||||||
name="connection_string",
|
name="connection_string",
|
||||||
|
value=DEFAULT_CONNECTION_STRING,
|
||||||
),
|
),
|
||||||
TemplateField(
|
TemplateField(
|
||||||
field_type="str",
|
field_type="str",
|
||||||
|
|
@ -109,7 +111,4 @@ class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode):
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
description: str = "Memory store with Postgres"
|
description: str = "Memory store with Postgres"
|
||||||
base_classes: list[str] = [
|
base_classes: list[str] = ["PostgresChatMessageHistory", "BaseChatMessageHistory"]
|
||||||
"PostgresChatMessageHistory",
|
|
||||||
"BaseChatMessageHistory"
|
|
||||||
]
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue