Minimize node fixes (#1029)

Fix Filter edges and unknown handle showing up when node are minimized
This commit is contained in:
anovazzi1 2023-10-09 21:29:46 -03:00 committed by GitHub
commit 5cd44bb288
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 5 deletions

View file

@ -164,7 +164,7 @@ class FrontendNode(BaseModel):
) -> None:
"""Handles specific field values for certain fields."""
if key == "headers":
field.value = """{'Authorization': 'Bearer <token>'}"""
field.value = """{"Authorization": "Bearer <token>"}"""
FrontendNode._handle_model_specific_field_values(field, key, name)
FrontendNode._handle_api_key_specific_field_values(field, key, name)
@ -249,4 +249,4 @@ class FrontendNode(BaseModel):
if "default" in value:
field.value = value["default"]
if key == "headers":
field.value = """{'Authorization': 'Bearer <token>'}"""
field.value = """{"Authorization": "Bearer <token>"}"""

View file

@ -145,7 +145,7 @@ class HeadersDefaultValueFormatter(FieldFormatter):
def format(self, field: TemplateField, name: Optional[str] = None) -> None:
key = field.name
if key == "headers":
field.value = """{'Authorization': 'Bearer <token>'}"""
field.value = """{"Authorization": "Bearer <token>"}"""
class DictCodeFileFormatter(FieldFormatter):

View file

@ -431,7 +431,7 @@ def set_headers_value(value: Dict[str, Any]) -> None:
"""
Sets the value for the 'headers' key.
"""
value["value"] = """{'Authorization': 'Bearer <token>'}"""
value["value"] = """{"Authorization": "Bearer <token>"}"""
def add_options_to_field(

View file

@ -204,7 +204,9 @@ export default function ParameterComponent({
type === "code" ||
type === "prompt" ||
type === "file" ||
type === "int") &&
type === "int" ||
type === "dict" ||
type === "NestedDict") &&
!optionalHandle ? (
<></>
) : (
@ -229,6 +231,9 @@ export default function ParameterComponent({
borderColor: color,
top: position,
}}
onClick={() => {
setFilterEdge(groupedEdge.current);
}}
></Handle>
</ShadTooltip>
)

View file

@ -280,6 +280,12 @@ export function TabsProvider({ children }: { children: ReactNode }) {
let id;
if (file) {
let text = await file.text();
let fileData = JSON.parse(text);
if (fileData.flows) {
fileData.flows.forEach((flow: FlowType) => {
id = addFlow(flow, newProject);
});
}
// parse the text into a JSON object
let flow: FlowType = JSON.parse(text);