Add _is_chat_input() method to Vertex and ChatVertex classes

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-03 18:55:39 -03:00
commit 20ffe250a9
2 changed files with 8 additions and 2 deletions

View file

@ -618,6 +618,9 @@ class Vertex:
self.steps_ran = []
self._build_params()
def _is_chat_input(self):
return False
def build_inactive(self):
# Just set the results to None
self._built = True
@ -640,7 +643,7 @@ class Vertex:
return self.get_requester_result(requester)
self._reset()
if self.is_input and inputs is not None:
if self._is_chat_input() and inputs is not None:
self.update_raw_params(inputs)
# Run steps

View file

@ -6,7 +6,7 @@ import yaml
from langchain_core.messages import AIMessage
from loguru import logger
from langflow.graph.schema import INPUT_FIELD_NAME
from langflow.graph.schema import INPUT_FIELD_NAME, InterfaceComponentTypes
from langflow.graph.utils import UnbuiltObject, flatten_list, serialize_field
from langflow.graph.vertex.base import StatefulVertex, StatelessVertex
from langflow.interface.utils import extract_input_variables_from_prompt
@ -455,6 +455,9 @@ class ChatVertex(StatelessVertex):
async for _ in self.stream():
pass
def _is_chat_input(self):
return self.vertex_type == InterfaceComponentTypes.ChatInput and self.is_input
class RoutingVertex(StatelessVertex):
def __init__(self, data: Dict, graph):