markdown-flow 0.2.7__py3-none-any.whl → 0.2.9__py3-none-any.whl
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.
Potentially problematic release.
This version of markdown-flow might be problematic. Click here for more details.
- markdown_flow/__init__.py +1 -1
- markdown_flow/core.py +86 -31
- {markdown_flow-0.2.7.dist-info → markdown_flow-0.2.9.dist-info}/METADATA +1 -1
- {markdown_flow-0.2.7.dist-info → markdown_flow-0.2.9.dist-info}/RECORD +7 -7
- {markdown_flow-0.2.7.dist-info → markdown_flow-0.2.9.dist-info}/WHEEL +0 -0
- {markdown_flow-0.2.7.dist-info → markdown_flow-0.2.9.dist-info}/licenses/LICENSE +0 -0
- {markdown_flow-0.2.7.dist-info → markdown_flow-0.2.9.dist-info}/top_level.txt +0 -0
markdown_flow/__init__.py
CHANGED
markdown_flow/core.py
CHANGED
|
@@ -492,7 +492,7 @@ class MarkdownFlow:
|
|
|
492
492
|
|
|
493
493
|
if not matched:
|
|
494
494
|
if allow_text_input:
|
|
495
|
-
# Allow custom text in buttons+text mode
|
|
495
|
+
# Allow custom text in buttons+text mode - same as normal interactions
|
|
496
496
|
valid_values.append(value)
|
|
497
497
|
else:
|
|
498
498
|
invalid_values.append(value)
|
|
@@ -1066,47 +1066,102 @@ Analyze the content and provide the structured interaction data.""")
|
|
|
1066
1066
|
context: list[dict[str, str]] | None,
|
|
1067
1067
|
variables: dict[str, str | list[str]] | None,
|
|
1068
1068
|
) -> LLMResult:
|
|
1069
|
-
"""Validate user input for dynamically generated interaction blocks."""
|
|
1069
|
+
"""Validate user input for dynamically generated interaction blocks using same logic as normal interactions."""
|
|
1070
1070
|
_ = block_index # Mark as intentionally unused
|
|
1071
|
-
_ = mode # Mark as intentionally unused
|
|
1072
1071
|
_ = context # Mark as intentionally unused
|
|
1073
1072
|
|
|
1074
1073
|
from .utils import InteractionParser
|
|
1075
1074
|
|
|
1076
|
-
# Parse the interaction format
|
|
1075
|
+
# Parse the interaction format using the same parser as normal interactions
|
|
1077
1076
|
parser = InteractionParser()
|
|
1078
|
-
|
|
1077
|
+
parse_result = parser.parse(interaction_format)
|
|
1079
1078
|
|
|
1080
|
-
if
|
|
1081
|
-
|
|
1079
|
+
if "error" in parse_result:
|
|
1080
|
+
error_msg = f"Invalid interaction format: {parse_result['error']}"
|
|
1081
|
+
return self._render_error(error_msg, mode)
|
|
1082
1082
|
|
|
1083
|
-
# Extract variable name
|
|
1084
|
-
|
|
1085
|
-
|
|
1083
|
+
# Extract variable name and interaction type
|
|
1084
|
+
variable_name = parse_result.get("variable")
|
|
1085
|
+
interaction_type = parse_result.get("type")
|
|
1086
1086
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1087
|
+
if not variable_name:
|
|
1088
|
+
error_msg = f"No variable found in interaction format: {interaction_format}"
|
|
1089
|
+
return self._render_error(error_msg, mode)
|
|
1090
1090
|
|
|
1091
|
-
|
|
1091
|
+
# Get user input for the target variable
|
|
1092
|
+
target_values = user_input.get(variable_name, [])
|
|
1092
1093
|
|
|
1093
|
-
#
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1094
|
+
# Basic validation - check if input is provided when required
|
|
1095
|
+
if not target_values:
|
|
1096
|
+
# Check if this is a text input or allows empty input
|
|
1097
|
+
allow_text_input = interaction_type in [
|
|
1098
|
+
InteractionType.BUTTONS_WITH_TEXT,
|
|
1099
|
+
InteractionType.BUTTONS_MULTI_WITH_TEXT,
|
|
1100
|
+
]
|
|
1097
1101
|
|
|
1098
|
-
|
|
1099
|
-
|
|
1102
|
+
if allow_text_input:
|
|
1103
|
+
# Allow empty input for buttons+text mode - merge with existing variables
|
|
1104
|
+
merged_variables = dict(variables or {})
|
|
1105
|
+
merged_variables[variable_name] = []
|
|
1106
|
+
return LLMResult(
|
|
1107
|
+
content="",
|
|
1108
|
+
variables=merged_variables,
|
|
1109
|
+
metadata={
|
|
1110
|
+
"interaction_type": "dynamic_interaction",
|
|
1111
|
+
"empty_input": True,
|
|
1112
|
+
},
|
|
1113
|
+
)
|
|
1114
|
+
else:
|
|
1115
|
+
error_msg = f"No input provided for variable '{variable_name}'"
|
|
1116
|
+
return self._render_error(error_msg, mode)
|
|
1100
1117
|
|
|
1101
|
-
#
|
|
1102
|
-
if
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1118
|
+
# Use the same validation logic as normal interactions
|
|
1119
|
+
if interaction_type in [
|
|
1120
|
+
InteractionType.BUTTONS_ONLY,
|
|
1121
|
+
InteractionType.BUTTONS_WITH_TEXT,
|
|
1122
|
+
InteractionType.BUTTONS_MULTI_SELECT,
|
|
1123
|
+
InteractionType.BUTTONS_MULTI_WITH_TEXT,
|
|
1124
|
+
]:
|
|
1125
|
+
# Button validation - reuse the existing button validation logic
|
|
1126
|
+
button_result = self._process_button_validation(
|
|
1127
|
+
parse_result,
|
|
1128
|
+
target_values,
|
|
1129
|
+
variable_name,
|
|
1130
|
+
mode,
|
|
1131
|
+
interaction_type,
|
|
1132
|
+
)
|
|
1106
1133
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1134
|
+
# Merge with existing variables for dynamic interactions
|
|
1135
|
+
if hasattr(button_result, 'variables') and button_result.variables is not None and variables:
|
|
1136
|
+
merged_variables = dict(variables)
|
|
1137
|
+
merged_variables.update(button_result.variables)
|
|
1138
|
+
return LLMResult(
|
|
1139
|
+
content=button_result.content,
|
|
1140
|
+
variables=merged_variables,
|
|
1141
|
+
metadata=button_result.metadata,
|
|
1142
|
+
)
|
|
1143
|
+
return button_result
|
|
1144
|
+
|
|
1145
|
+
elif interaction_type == InteractionType.NON_ASSIGNMENT_BUTTON:
|
|
1146
|
+
# Non-assignment buttons: don't set variables, keep existing ones
|
|
1147
|
+
return LLMResult(
|
|
1148
|
+
content="",
|
|
1149
|
+
variables=dict(variables or {}),
|
|
1150
|
+
metadata={
|
|
1151
|
+
"interaction_type": "non_assignment_button",
|
|
1152
|
+
"user_input": user_input,
|
|
1153
|
+
},
|
|
1154
|
+
)
|
|
1155
|
+
else:
|
|
1156
|
+
# Text-only input type - merge with existing variables
|
|
1157
|
+
merged_variables = dict(variables or {})
|
|
1158
|
+
merged_variables[variable_name] = target_values
|
|
1159
|
+
return LLMResult(
|
|
1160
|
+
content="",
|
|
1161
|
+
variables=merged_variables,
|
|
1162
|
+
metadata={
|
|
1163
|
+
"interaction_type": "text_only",
|
|
1164
|
+
"target_variable": variable_name,
|
|
1165
|
+
"values": target_values,
|
|
1166
|
+
},
|
|
1167
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: markdown-flow
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
4
4
|
Summary: An agent library designed to parse and process MarkdownFlow documents
|
|
5
5
|
Project-URL: Homepage, https://github.com/ai-shifu/markdown-flow-agent-py
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/ai-shifu/markdown-flow-agent-py/issues
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
markdown_flow/__init__.py,sha256=
|
|
1
|
+
markdown_flow/__init__.py,sha256=zeJ4ycW4uPIIRp3sFbh_FPn-jUXSuZk6wUqnrls_6r0,2874
|
|
2
2
|
markdown_flow/constants.py,sha256=pd_KCpTEVlz_IXYekrByqb9VWCQR_XHXoGsFYdLW1Eg,8006
|
|
3
|
-
markdown_flow/core.py,sha256
|
|
3
|
+
markdown_flow/core.py,sha256=-cJBzyeL5dWs-iI_-7vnBstIt0GEhkmiyve0wXunedg,48618
|
|
4
4
|
markdown_flow/enums.py,sha256=Wr41zt0Ce5b3fyLtOTE2erEVp1n92g9OVaBF_BZg_l8,820
|
|
5
5
|
markdown_flow/exceptions.py,sha256=9sUZ-Jd3CPLdSRqG8Pw7eMm7cv_S3VZM6jmjUU8OhIc,976
|
|
6
6
|
markdown_flow/llm.py,sha256=7DjOL2h2N1g0L4NF9kn0M5mR45ZL0vPsW3TzuOGy1bw,2547
|
|
7
7
|
markdown_flow/models.py,sha256=ENcvXMVXwpFN-RzbeVHhXTjBN0bbmRpJ96K-XS2rizI,2893
|
|
8
8
|
markdown_flow/utils.py,sha256=cVi0zDRK_rCMAr3EDhgITmx6Po5fSvYjqrprYaitYE0,28450
|
|
9
|
-
markdown_flow-0.2.
|
|
10
|
-
markdown_flow-0.2.
|
|
11
|
-
markdown_flow-0.2.
|
|
12
|
-
markdown_flow-0.2.
|
|
13
|
-
markdown_flow-0.2.
|
|
9
|
+
markdown_flow-0.2.9.dist-info/licenses/LICENSE,sha256=qz3BziejhHPd1xa5eVtYEU5Qp6L2pn4otuj194uGxmc,1069
|
|
10
|
+
markdown_flow-0.2.9.dist-info/METADATA,sha256=T4V_MG3pWdsXOcHkk5jDPcPQCwMSRn_GKkkfso4wh-U,24286
|
|
11
|
+
markdown_flow-0.2.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
+
markdown_flow-0.2.9.dist-info/top_level.txt,sha256=DpigGvQuIt2L0TTLnDU5sylhiTGiZS7MmAMa2hi-AJs,14
|
|
13
|
+
markdown_flow-0.2.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|