Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -342,8 +342,13 @@ async def execute_node(node: ExecutionNode, inputs: Dict[str, Any], api_key: Opt
|
|
| 342 |
# If content is not a data URL (e.g. plain text sent directly)
|
| 343 |
return file_content
|
| 344 |
|
| 345 |
-
# Return text/number value if provided
|
|
|
|
| 346 |
if input_value:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
return input_value
|
| 348 |
|
| 349 |
# Default: return input name
|
|
@@ -355,7 +360,11 @@ async def execute_node(node: ExecutionNode, inputs: Dict[str, Any], api_key: Opt
|
|
| 355 |
for key, value in inputs.items():
|
| 356 |
if isinstance(value, list):
|
| 357 |
value = ", ".join(str(v) for v in value)
|
| 358 |
-
text =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
return text
|
| 360 |
|
| 361 |
elif node_type == 'llm':
|
|
|
|
| 342 |
# If content is not a data URL (e.g. plain text sent directly)
|
| 343 |
return file_content
|
| 344 |
|
| 345 |
+
# Return text/number value if provided. Also tolerate the common
|
| 346 |
+
# copied format "name: foo, value: bar" and use only the value.
|
| 347 |
if input_value:
|
| 348 |
+
if isinstance(input_value, str):
|
| 349 |
+
value_match = re.match(r'^\s*name\s*:\s*[^,]+,\s*value\s*:\s*(.*)\s*$', input_value)
|
| 350 |
+
if value_match:
|
| 351 |
+
return value_match.group(1)
|
| 352 |
return input_value
|
| 353 |
|
| 354 |
# Default: return input name
|
|
|
|
| 360 |
for key, value in inputs.items():
|
| 361 |
if isinstance(value, list):
|
| 362 |
value = ", ".join(str(v) for v in value)
|
| 363 |
+
text = re.sub(
|
| 364 |
+
r'\{\{\s*' + re.escape(str(key)) + r'\s*\}\}',
|
| 365 |
+
str(value),
|
| 366 |
+
text
|
| 367 |
+
)
|
| 368 |
return text
|
| 369 |
|
| 370 |
elif node_type == 'llm':
|