fix: starter projects refresh don't add new fields (#3110)
export stremaing module
This commit is contained in:
parent
1a5156784c
commit
aa46f320ab
8 changed files with 287 additions and 0 deletions
|
|
@ -102,6 +102,7 @@ def update_projects_components_with_latest_component_versions(project_data, all_
|
|||
|
||||
for field_name, field_dict in latest_template.items():
|
||||
if field_name not in node_data["template"]:
|
||||
node_data["template"][field_name] = field_dict
|
||||
continue
|
||||
# The idea here is to update some attributes of the field
|
||||
to_check_attributes = FIELD_FORMAT_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -262,6 +262,22 @@
|
|||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
},
|
||||
"should_store_message": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Store Messages",
|
||||
"dynamic": false,
|
||||
"info": "Store the message in the history.",
|
||||
"list": false,
|
||||
"name": "should_store_message",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_metadata": true,
|
||||
"type": "bool",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -559,6 +575,22 @@
|
|||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
},
|
||||
"should_store_message": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Store Messages",
|
||||
"dynamic": false,
|
||||
"info": "Store the message in the history.",
|
||||
"list": false,
|
||||
"name": "should_store_message",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_metadata": true,
|
||||
"type": "bool",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -640,6 +672,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
|
|||
|
|
@ -763,6 +763,22 @@
|
|||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
},
|
||||
"should_store_message": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Store Messages",
|
||||
"dynamic": false,
|
||||
"info": "Store the message in the history.",
|
||||
"list": false,
|
||||
"name": "should_store_message",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_metadata": true,
|
||||
"type": "bool",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -844,6 +860,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
|
|||
|
|
@ -902,6 +902,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
@ -2010,6 +2027,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
@ -2691,6 +2725,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
@ -3092,6 +3143,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
@ -3518,6 +3586,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
|
|||
|
|
@ -459,6 +459,22 @@
|
|||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
},
|
||||
"should_store_message": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Store Messages",
|
||||
"dynamic": false,
|
||||
"info": "Store the message in the history.",
|
||||
"list": false,
|
||||
"name": "should_store_message",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_metadata": true,
|
||||
"type": "bool",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -637,6 +653,22 @@
|
|||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
},
|
||||
"should_store_message": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Store Messages",
|
||||
"dynamic": false,
|
||||
"info": "Store the message in the history.",
|
||||
"list": false,
|
||||
"name": "should_store_message",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_metadata": true,
|
||||
"type": "bool",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -718,6 +750,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
|
|||
|
|
@ -433,6 +433,22 @@
|
|||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
},
|
||||
"should_store_message": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Store Messages",
|
||||
"dynamic": false,
|
||||
"info": "Store the message in the history.",
|
||||
"list": false,
|
||||
"name": "should_store_message",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_metadata": true,
|
||||
"type": "bool",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -514,6 +530,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
@ -889,6 +922,22 @@
|
|||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
},
|
||||
"should_store_message": {
|
||||
"_input_type": "BoolInput",
|
||||
"advanced": true,
|
||||
"display_name": "Store Messages",
|
||||
"dynamic": false,
|
||||
"info": "Store the message in the history.",
|
||||
"list": false,
|
||||
"name": "should_store_message",
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"trace_as_metadata": true,
|
||||
"type": "bool",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2048,6 +2048,23 @@
|
|||
"pinned": false,
|
||||
"template": {
|
||||
"_type": "Component",
|
||||
"api_key": {
|
||||
"_input_type": "SecretStrInput",
|
||||
"advanced": false,
|
||||
"display_name": "OpenAI API Key",
|
||||
"dynamic": false,
|
||||
"info": "The OpenAI API Key to use for the OpenAI model.",
|
||||
"input_types": [],
|
||||
"load_from_db": true,
|
||||
"name": "api_key",
|
||||
"password": true,
|
||||
"placeholder": "",
|
||||
"required": false,
|
||||
"show": true,
|
||||
"title_case": false,
|
||||
"type": "str",
|
||||
"value": "OPENAI_API_KEY"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
"dynamic": true,
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ async def test_refresh_starter_projects():
|
|||
chat_input = find_componeny_by_name(components, "ChatInput")
|
||||
chat_output = find_componeny_by_name(components, "ChatOutput")
|
||||
chat_output["template"]["code"]["value"] = "changed !"
|
||||
del chat_output["template"]["should_store_message"]
|
||||
graph_data = {
|
||||
"nodes": [
|
||||
component_to_node("chat-input-1", "ChatInput", chat_input),
|
||||
|
|
@ -140,3 +141,6 @@ async def test_refresh_starter_projects():
|
|||
new_change = update_projects_components_with_latest_component_versions(graph_data, all_types)
|
||||
assert graph_data["nodes"][1]["data"]["node"]["template"]["code"]["value"] == "changed !"
|
||||
assert new_change["nodes"][1]["data"]["node"]["template"]["code"]["value"] != "changed !"
|
||||
|
||||
assert "should_store_message" not in graph_data["nodes"][1]["data"]["node"]["template"]
|
||||
assert "should_store_message" in new_change["nodes"][1]["data"]["node"]["template"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue