model-compose 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {model_compose-0.1.2 → model_compose-0.1.3}/PKG-INFO +1 -1
- {model_compose-0.1.2 → model_compose-0.1.3}/pyproject.toml +1 -1
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/engine/http_server.py +2 -2
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/webui/gradio.py +19 -6
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/webui/schema.py +16 -8
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/webui/webui.py +3 -3
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/utils/http_client.py +3 -5
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/workflow/job.py +2 -2
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/workflow.py +3 -1
- {model_compose-0.1.2 → model_compose-0.1.3}/src/model_compose.egg-info/PKG-INFO +1 -1
- {model_compose-0.1.2 → model_compose-0.1.3}/LICENSE +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/README.md +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/setup.cfg +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/cli/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/cli/compose.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/component/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/component/component.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/component/engine/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/component/engine/base.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/component/engine/context.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/component/engine/http_client.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/component/engine/http_server.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/compose/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/compose/compose.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/compose/manager.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/controller.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/engine/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/engine/base.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/engine/mcp_server.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/runner/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/runner/client.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/runner/http_client.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/runner/mcp_client.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/runner/runner.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/webui/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/gateway/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/gateway/engine/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/gateway/engine/base.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/gateway/engine/http_tunnel.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/gateway/gateway.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/listener/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/listener/engine/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/listener/engine/base.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/listener/engine/http_callback.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/listener/listener.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/runtime/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/runtime/env.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/services/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/services/async_service.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/utils/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/utils/expiring.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/utils/http_request.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/utils/image.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/utils/streaming.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/utils/template.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/utils/time.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/utils/workqueue.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/workflow/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/workflow/context.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/workflow/workflow.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/loader.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/action.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/impl/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/impl/common.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/impl/http_client.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/impl/http_server.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/impl/mcp_client.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/impl/mcp_server.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/component.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/common.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/http_client.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/http_server.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/mcp_client.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/mcp_server.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/types.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/compose.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/controller.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/impl/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/impl/common.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/impl/http_server.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/impl/mcp_server.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/impl/types.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/impl/webui.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/gateway/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/gateway/gateway.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/gateway/impl/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/gateway/impl/common.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/gateway/impl/http_tunnel.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/gateway/impl/types.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/listener/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/listener/impl/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/listener/impl/common.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/listener/impl/http_callback.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/listener/impl/types.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/listener/listener.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/runtime/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/runtime/impl/__init__.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/runtime/impl/common.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/runtime/impl/docker.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/runtime/impl/types.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/runtime/runtime.py +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/model_compose.egg-info/SOURCES.txt +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/model_compose.egg-info/dependency_links.txt +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/model_compose.egg-info/entry_points.txt +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/model_compose.egg-info/requires.txt +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/src/model_compose.egg-info/top_level.txt +0 -0
- {model_compose-0.1.2 → model_compose-0.1.3}/tests/test_cli.py +0 -0
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/engine/http_server.py
RENAMED
|
@@ -15,7 +15,7 @@ from fastapi import FastAPI, APIRouter, Request, Body, HTTPException
|
|
|
15
15
|
from fastapi.middleware.cors import CORSMiddleware
|
|
16
16
|
from fastapi.responses import Response, JSONResponse, StreamingResponse
|
|
17
17
|
from starlette.background import BackgroundTask
|
|
18
|
-
import
|
|
18
|
+
import uvicorn
|
|
19
19
|
|
|
20
20
|
class WorkflowTaskRequestBody(BaseModel):
|
|
21
21
|
workflow_id: Optional[str] = None
|
|
@@ -50,7 +50,7 @@ class HttpServerController(ControllerEngine):
|
|
|
50
50
|
daemon: bool
|
|
51
51
|
):
|
|
52
52
|
super().__init__(config, components, listeners, gateways, workflows, env, daemon)
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
self.server: Optional[uvicorn.Server] = None
|
|
55
55
|
self.app: FastAPI = FastAPI(openapi_url=None, docs_url=None, redoc_url=None)
|
|
56
56
|
self.router: APIRouter = APIRouter()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Callable, Awaitable, Any
|
|
2
2
|
from mindor.dsl.schema.workflow import WorkflowVariableConfig, WorkflowVariableGroupConfig
|
|
3
|
-
from mindor.core.utils.http_client import HttpStreamResource
|
|
3
|
+
from mindor.core.utils.http_client import HttpClient, HttpStreamResource
|
|
4
4
|
from mindor.core.utils.image import load_image_from_stream
|
|
5
5
|
from mindor.core.utils.streaming import Base64StreamResource, save_stream_to_temporary_file
|
|
6
6
|
from .schema import WorkflowSchema
|
|
@@ -29,8 +29,8 @@ class GradioWebUIBuilder:
|
|
|
29
29
|
|
|
30
30
|
def _build_workflow_section(self, workflow: WorkflowSchema, runner: Callable[[Any], Awaitable[Any]]) -> gr.Column:
|
|
31
31
|
with gr.Column() as section:
|
|
32
|
-
gr.Markdown(f"## **{workflow.title or 'Untitled Workflow'}**")
|
|
33
|
-
|
|
32
|
+
gr.Markdown(f"## **{workflow.title or 'Untitled Workflow'}**")
|
|
33
|
+
|
|
34
34
|
if workflow.description:
|
|
35
35
|
gr.Markdown(f"📝 {workflow.description}")
|
|
36
36
|
|
|
@@ -74,13 +74,19 @@ class GradioWebUIBuilder:
|
|
|
74
74
|
|
|
75
75
|
if variable.type == "boolean":
|
|
76
76
|
return gr.Checkbox(label=label, value=default or False, info=info)
|
|
77
|
+
|
|
78
|
+
if variable.type == "image":
|
|
79
|
+
return gr.Image(label=label, type="filepath")
|
|
80
|
+
|
|
81
|
+
if variable.type == "video":
|
|
82
|
+
return gr.Video(label=label)
|
|
77
83
|
|
|
78
84
|
if variable.type == "file":
|
|
79
|
-
return gr.File(label=label
|
|
85
|
+
return gr.File(label=label)
|
|
80
86
|
|
|
81
87
|
if variable.type == "select":
|
|
82
88
|
return gr.Dropdown(choices=variable.options or [], label=label, value=default, info=info)
|
|
83
|
-
|
|
89
|
+
|
|
84
90
|
return gr.Textbox(label=label, value=default, info=f"Unsupported type: {variable.type}")
|
|
85
91
|
|
|
86
92
|
def _build_output_component(self, variable: Union[WorkflowVariableConfig, WorkflowVariableGroupConfig]) -> Union[gr.Component, List[ComponentGroup]]:
|
|
@@ -105,6 +111,9 @@ class GradioWebUIBuilder:
|
|
|
105
111
|
if variable.type == "audio":
|
|
106
112
|
return gr.Audio(label=label)
|
|
107
113
|
|
|
114
|
+
if variable.type == "video":
|
|
115
|
+
return gr.Video(label=label)
|
|
116
|
+
|
|
108
117
|
return gr.Textbox(label=label, info=f"Unsupported type: {variable.type}")
|
|
109
118
|
|
|
110
119
|
def _flatten_output_components(self, components: List[Union[gr.Component, List[ComponentGroup]]]) -> List[gr.Component]:
|
|
@@ -136,13 +145,17 @@ class GradioWebUIBuilder:
|
|
|
136
145
|
return str(value)
|
|
137
146
|
|
|
138
147
|
if type == "image":
|
|
148
|
+
if format == "url" and isinstance(value, str):
|
|
149
|
+
return await load_image_from_stream(await HttpClient().request(value), subtype)
|
|
139
150
|
if format == "base64" and isinstance(value, str):
|
|
140
151
|
return await load_image_from_stream(Base64StreamResource(value), subtype)
|
|
141
152
|
if isinstance(value, HttpStreamResource):
|
|
142
153
|
return await load_image_from_stream(value, subtype)
|
|
143
154
|
return None
|
|
144
155
|
|
|
145
|
-
if type
|
|
156
|
+
if type in [ "audio", "video" ]:
|
|
157
|
+
if format == "url" and isinstance(value, str):
|
|
158
|
+
return await save_stream_to_temporary_file(await HttpClient().request(value), subtype)
|
|
146
159
|
if format == "base64" and isinstance(value, str):
|
|
147
160
|
return await save_stream_to_temporary_file(Base64StreamResource(value), subtype)
|
|
148
161
|
if isinstance(value, HttpStreamResource):
|
|
@@ -111,17 +111,25 @@ class WorkflowVariableResolver:
|
|
|
111
111
|
if isinstance(item, WorkflowVariableGroup):
|
|
112
112
|
group: List[WorkflowVariableConfig] = []
|
|
113
113
|
seen_in_group: Set[WorkflowVariable] = set()
|
|
114
|
-
for
|
|
115
|
-
if
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
for variable in item.variables:
|
|
115
|
+
if variable not in seen_in_group:
|
|
116
|
+
group.append(self._to_variable_config(variable))
|
|
117
|
+
seen_in_group.add(variable)
|
|
118
118
|
configs.append(WorkflowVariableGroupConfig(name=item.name, variables=group, repeat_count=item.repeat_count))
|
|
119
119
|
else:
|
|
120
120
|
if item not in seen_single:
|
|
121
|
+
configs.append(self._to_variable_config(item))
|
|
121
122
|
seen_single.add(item)
|
|
122
|
-
configs.append(WorkflowVariableConfig(**item.to_dict()))
|
|
123
123
|
|
|
124
124
|
return configs
|
|
125
|
+
|
|
126
|
+
def _to_variable_config(self, variable: WorkflowVariable) -> WorkflowVariableConfig:
|
|
127
|
+
config_dict = variable.to_dict()
|
|
128
|
+
|
|
129
|
+
if variable.type == "select" and variable.subtype:
|
|
130
|
+
config_dict["options"] = variable.subtype.split(",")
|
|
131
|
+
|
|
132
|
+
return WorkflowVariableConfig(**config_dict)
|
|
125
133
|
|
|
126
134
|
def _parse_as_type(self, value: Any, type: str) -> Any:
|
|
127
135
|
if type == "number":
|
|
@@ -138,7 +146,7 @@ class WorkflowVariableResolver:
|
|
|
138
146
|
|
|
139
147
|
return value
|
|
140
148
|
|
|
141
|
-
class
|
|
149
|
+
class WorkflowInputVariableResolver(WorkflowVariableResolver):
|
|
142
150
|
def resolve(self, workflow: WorkflowConfig, components: Dict[str, ComponentConfig]) -> List[WorkflowVariableConfig]:
|
|
143
151
|
variables: List[WorkflowVariable] = []
|
|
144
152
|
|
|
@@ -154,12 +162,12 @@ class WorkflowInputResolver(WorkflowVariableResolver):
|
|
|
154
162
|
else:
|
|
155
163
|
variables.extend(self._enumerate_input_variables(job.input, "input"))
|
|
156
164
|
|
|
157
|
-
for value in [ job.repeat_count ]:
|
|
165
|
+
for value in [ job.component, job.action, job.repeat_count ]:
|
|
158
166
|
variables.extend(self._enumerate_input_variables(value, "input"))
|
|
159
167
|
|
|
160
168
|
return self._to_variable_config_list(variables)
|
|
161
169
|
|
|
162
|
-
class
|
|
170
|
+
class WorkflowOutputVariableResolver(WorkflowVariableResolver):
|
|
163
171
|
def resolve(self, workflow: WorkflowConfig, components: Dict[str, ComponentConfig]) -> List[Union[WorkflowVariableConfig, WorkflowVariableGroupConfig]]:
|
|
164
172
|
variables: List[Union[WorkflowVariable, WorkflowVariableGroup]] = []
|
|
165
173
|
|
|
@@ -4,7 +4,7 @@ from mindor.dsl.schema.component import ComponentConfig
|
|
|
4
4
|
from mindor.dsl.schema.workflow import WorkflowConfig
|
|
5
5
|
from mindor.core.controller.runner import ControllerRunner
|
|
6
6
|
from mindor.core.services import AsyncService
|
|
7
|
-
from .schema import WorkflowSchema,
|
|
7
|
+
from .schema import WorkflowSchema, WorkflowInputVariableResolver, WorkflowOutputVariableResolver
|
|
8
8
|
from .gradio import GradioWebUIBuilder
|
|
9
9
|
|
|
10
10
|
from fastapi import FastAPI, APIRouter, Body, HTTPException
|
|
@@ -68,8 +68,8 @@ class ControllerWebUI(AsyncService):
|
|
|
68
68
|
name=workflow.name,
|
|
69
69
|
title=workflow.title,
|
|
70
70
|
description=workflow.description,
|
|
71
|
-
input=
|
|
72
|
-
output=
|
|
71
|
+
input=WorkflowInputVariableResolver().resolve(workflow, self.components),
|
|
72
|
+
output=WorkflowOutputVariableResolver().resolve(workflow, self.components)
|
|
73
73
|
)
|
|
74
74
|
|
|
75
75
|
return schema
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, AsyncIterator, Any
|
|
2
2
|
from .http_request import serialize_request_body, parse_options_header
|
|
3
3
|
from .streaming import StreamResource
|
|
4
|
-
|
|
5
|
-
from urllib.parse import urlencode
|
|
6
|
-
import aiohttp, json
|
|
4
|
+
import aiohttp
|
|
7
5
|
|
|
8
6
|
class HttpStreamResource(StreamResource):
|
|
9
7
|
def __init__(self, session: aiohttp.ClientSession, stream: aiohttp.StreamReader, content_type: Optional[str] = None, filename: Optional[str] = None):
|
|
@@ -28,7 +26,7 @@ class HttpStreamResource(StreamResource):
|
|
|
28
26
|
yield chunk
|
|
29
27
|
|
|
30
28
|
class HttpClient:
|
|
31
|
-
async def request(self, url: str, method: str, params: Optional[Dict[str, Any]], body: Optional[Any], headers: Optional[Dict[str, str]]) -> Any:
|
|
29
|
+
async def request(self, url: str, method: Optional[str] = "GET", params: Optional[Dict[str, Any]] = None, body: Optional[Any] = None, headers: Optional[Dict[str, str]] = None) -> Any:
|
|
32
30
|
session = aiohttp.ClientSession()
|
|
33
31
|
try:
|
|
34
32
|
response = await session.request(
|
|
@@ -57,7 +55,7 @@ class HttpClient:
|
|
|
57
55
|
|
|
58
56
|
if content_type and body:
|
|
59
57
|
return await serialize_request_body(body, content_type)
|
|
60
|
-
|
|
58
|
+
|
|
61
59
|
return body
|
|
62
60
|
|
|
63
61
|
async def _parse_response_content(self, session: aiohttp.ClientSession, response: aiohttp.ClientResponse) -> Any:
|
|
@@ -12,7 +12,7 @@ class Job:
|
|
|
12
12
|
self.component_provider: Callable[[str, Union[ComponentConfig, str]], ComponentEngine] = component_provider
|
|
13
13
|
|
|
14
14
|
async def run(self, context: WorkflowContext) -> Any:
|
|
15
|
-
component: ComponentEngine = self.component_provider(self.id, self.config.component)
|
|
15
|
+
component: ComponentEngine = self.component_provider(self.id, await context.render_template(self.config.component))
|
|
16
16
|
|
|
17
17
|
if not component.started:
|
|
18
18
|
await component.start()
|
|
@@ -22,7 +22,7 @@ class Job:
|
|
|
22
22
|
|
|
23
23
|
async def _run_once():
|
|
24
24
|
call_id = ulid.ulid()
|
|
25
|
-
output = await component.run(self.config.action, call_id, input)
|
|
25
|
+
output = await component.run(await context.render_template(self.config.action), call_id, input)
|
|
26
26
|
context.register_source("output", output)
|
|
27
27
|
|
|
28
28
|
output = (await context.render_template(self.config.output)) if self.config.output else output
|
|
@@ -31,6 +31,7 @@ class WorkflowVariableType(str, Enum):
|
|
|
31
31
|
# Media and files
|
|
32
32
|
IMAGE = "image"
|
|
33
33
|
AUDIO = "audio"
|
|
34
|
+
VIDEO = "video"
|
|
34
35
|
FILE = "file"
|
|
35
36
|
# UI-related types
|
|
36
37
|
SELECT = "select"
|
|
@@ -39,16 +40,17 @@ class WorkflowVariableFormat(str, Enum):
|
|
|
39
40
|
BASE64 = "base64"
|
|
40
41
|
URL = "url"
|
|
41
42
|
PATH = "path"
|
|
43
|
+
STREAM = "stream"
|
|
42
44
|
|
|
43
45
|
class WorkflowVariableConfig(BaseModel):
|
|
44
46
|
name: Optional[str] = Field(default=None, description="The name of the variable")
|
|
45
47
|
type: WorkflowVariableType = Field(..., description="Type of the variable")
|
|
46
48
|
subtype: Optional[str] = Field(default=None, description="Subtype of the variable")
|
|
47
49
|
format: Optional[WorkflowVariableFormat] = Field(default=None, description="Format of the variable")
|
|
50
|
+
options: Optional[List[str]] = Field(default=None, description="List of valid options for select type")
|
|
48
51
|
required: bool = Field(default=False, description="Whether this variable is required")
|
|
49
52
|
default: Optional[Any] = Field(default=None, description="Default value if not provided")
|
|
50
53
|
description: Optional[str] = Field(default=None, description="Description of the variable")
|
|
51
|
-
options: Optional[List[Any]] = Field(default=None, description="List of valid options for select type")
|
|
52
54
|
|
|
53
55
|
class WorkflowVariableGroupConfig(BaseModel):
|
|
54
56
|
name: Optional[str] = Field(default=None, description="The name of the group of variables")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/controller/runner/http_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/core/listener/engine/http_callback.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/impl/http_client.py
RENAMED
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/action/impl/http_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/http_client.py
RENAMED
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/http_server.py
RENAMED
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/mcp_client.py
RENAMED
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/component/impl/mcp_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/impl/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/impl/http_server.py
RENAMED
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/controller/impl/mcp_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/gateway/impl/http_tunnel.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.1.2 → model_compose-0.1.3}/src/mindor/dsl/schema/listener/impl/http_callback.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|