Merge branch 'cz/mergeAll' of https://github.com/langflow-ai/langflow into cz/mergeAll

This commit is contained in:
cristhianzl 2024-06-10 14:15:00 -03:00
commit e719f1746f
7 changed files with 18 additions and 6 deletions

View file

@ -219,7 +219,7 @@ async def build_and_cache_graph_from_db(flow_id: str, session: Session, chat_ser
if vertex is None:
raise ValueError(f"Vertex {vertex_id} not found")
if not vertex._raw_params.get("session_id"):
vertex.update_raw_params({"session_id": flow_id})
vertex.update_raw_params({"session_id": flow_id}, overwrite=True)
await chat_service.set_cache(flow_id, graph)
return graph

View file

@ -16,4 +16,5 @@ class RecordOutput(CustomComponent):
}
def build(self, input_value: Record) -> Record:
self.status = input_value
return input_value

View file

@ -126,8 +126,11 @@ class CustomComponent(Component):
@staticmethod
def resolve_path(path: str) -> str:
"""Resolves the path to an absolute path."""
if not path:
return path
path_object = Path(path)
if path_object.parts[0] == "~":
if path_object.parts and path_object.parts[0] == "~":
path_object = path_object.expanduser()
elif path_object.is_relative_to("."):
path_object = path_object.resolve()

View file

@ -25,6 +25,7 @@ class Prompt(Record):
prompt_template = PromptTemplate.from_template(self.template)
variables_with_str_values = dict_values_to_string(self.variables)
formatted_prompt = prompt_template.format(**variables_with_str_values)
self.text = formatted_prompt
return formatted_prompt
@classmethod

View file

@ -1,12 +1,12 @@
import copy
import json
from typing import cast, Optional
from typing import Optional, cast
from langchain_core.documents import Document
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage, SystemMessage
from langchain_core.prompt_values import ImagePromptValue
from langchain_core.prompts.image import ImagePromptTemplate
from pydantic import BaseModel, model_serializer, model_validator
from langchain_core.prompt_values import ImagePromptValue
class Record(BaseModel):
@ -200,3 +200,6 @@ class Record(BaseModel):
def __contains__(self, key):
return key in self.data
def __eq__(self, other):
return isinstance(other, Record) and self.data == other.data

View file

@ -28,7 +28,7 @@ export default function SwitchOutputView(nodeId): JSX.Element {
if (resultMessage.raw) {
resultMessage = resultMessage.raw;
}
console.log("resultType", results);
return (
<>
<Case condition={!resultType || resultType === "unknown"}>

View file

@ -254,7 +254,11 @@ export default function IOFieldView({
<div className={left ? "h-56" : "h-full"}>
<RecordsOutputComponent
pagination={!left}
rows={flowPoolNode?.data?.artifacts?.records ?? []}
rows={
flowPoolNode?.data?.artifacts?.map(
(artifact) => artifact.data
) ?? []
}
columnMode="union"
/>
</div>