完善建模交互、组件图标与系统协议
This commit is contained in:
1 parent
456c29b3b6
commit
6572defaa4
66 files changed
+10067
-4163
No files matched your search
@@ -24,6 +24,7 @@ from app.main import (
|
||||
simulate_system_xml,
|
||||
)
|
||||
from app.simulation.components.experimental.flow.resistive_pipe import ResistivePipe
|
||||
from app.simulation.registry import get_component_model_spec
|
||||
from app.simulation.solvers.solver import SolveIVPConfig
|
||||
from app.simulation.systems.generic import (
|
||||
GenericFluidSystem,
|
||||
@@ -46,6 +47,7 @@ def component_node(
|
||||
"label": component_id,
|
||||
"componentType": model_type,
|
||||
"modelType": model_type,
|
||||
"modelVersion": get_component_model_spec(model_type).model_version,
|
||||
"ports": ports,
|
||||
"parameters": parameters or {},
|
||||
},
|
||||
@@ -101,6 +103,7 @@ def chain_project(*, reverse_edges: bool = False) -> ReactFlowProjectPayload:
|
||||
for edge in edges
|
||||
]
|
||||
return ReactFlowProjectPayload(
|
||||
projectSchemaVersion=1,
|
||||
name="generic-chain",
|
||||
nodes=[
|
||||
component_node(
|
||||
@@ -147,6 +150,7 @@ def chain_project(*, reverse_edges: bool = False) -> ReactFlowProjectPayload:
|
||||
|
||||
def branched_project() -> ReactFlowProjectPayload:
|
||||
return ReactFlowProjectPayload(
|
||||
projectSchemaVersion=1,
|
||||
name="generic-branch",
|
||||
nodes=[
|
||||
component_node(
|
||||
@@ -536,7 +540,7 @@ class GenericSystemXmlSimulationTests(unittest.TestCase):
|
||||
def test_streaming_endpoint_returns_structured_validation_error(self) -> None:
|
||||
events = [
|
||||
json.loads(line)
|
||||
for line in simulation_event_stream(b"<System schemaVersion='2'>")
|
||||
for line in simulation_event_stream(b"<System schemaVersion='3'>")
|
||||
]
|
||||
|
||||
self.assertEqual(events[-1]["event"], "error")
|
||||
|
||||
Reference in new issue
Block a user