markdown-flow 0.2.8__tar.gz → 0.2.9__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.
Potentially problematic release.
This version of markdown-flow might be problematic. Click here for more details.
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/PKG-INFO +1 -1
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow/__init__.py +1 -1
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow/core.py +2 -2
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow.egg-info/PKG-INFO +1 -1
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/tests/test_dynamic_interaction.py +85 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/LICENSE +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/README.md +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow/constants.py +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow/enums.py +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow/exceptions.py +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow/llm.py +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow/models.py +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow/utils.py +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow.egg-info/SOURCES.txt +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow.egg-info/dependency_links.txt +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/markdown_flow.egg-info/top_level.txt +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/pyproject.toml +0 -0
- {markdown_flow-0.2.8 → markdown_flow-0.2.9}/setup.cfg +0 -0
|
@@ -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
|
|
@@ -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)
|
|
@@ -1132,7 +1132,7 @@ Analyze the content and provide the structured interaction data.""")
|
|
|
1132
1132
|
)
|
|
1133
1133
|
|
|
1134
1134
|
# Merge with existing variables for dynamic interactions
|
|
1135
|
-
if hasattr(button_result, 'variables') and variables:
|
|
1135
|
+
if hasattr(button_result, 'variables') and button_result.variables is not None and variables:
|
|
1136
1136
|
merged_variables = dict(variables)
|
|
1137
1137
|
merged_variables.update(button_result.variables)
|
|
1138
1138
|
return LLMResult(
|
|
@@ -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
|
|
@@ -823,6 +823,91 @@ Format: Provide specific project options based on the selected programming langu
|
|
|
823
823
|
print(f"❌ Test failed: {e}")
|
|
824
824
|
|
|
825
825
|
|
|
826
|
+
def test_user_question_text_input():
|
|
827
|
+
"""测试用户疑问式文本输入场景"""
|
|
828
|
+
print("\n=== 用户疑问文本输入测试 ===")
|
|
829
|
+
|
|
830
|
+
document = """询问用户的故事风格偏好,并记录到变量{{风格选择}}"""
|
|
831
|
+
|
|
832
|
+
document_prompt = """你是故事创作助手。为用户提供故事风格选项:
|
|
833
|
+
- 常见风格:幽默、搞笑、悬疑、浪漫、文言文
|
|
834
|
+
- 同时允许用户输入其他风格偏好
|
|
835
|
+
|
|
836
|
+
语言:中文
|
|
837
|
+
格式:提供常见风格选项 + 允许自定义文本输入(使用...前缀)"""
|
|
838
|
+
|
|
839
|
+
try:
|
|
840
|
+
llm_provider = create_llm_provider()
|
|
841
|
+
mf = MarkdownFlow(
|
|
842
|
+
document=document,
|
|
843
|
+
llm_provider=llm_provider,
|
|
844
|
+
document_prompt=document_prompt
|
|
845
|
+
)
|
|
846
|
+
|
|
847
|
+
# 生成动态交互
|
|
848
|
+
print("--- 生成故事风格选项 ---")
|
|
849
|
+
result1 = mf.process(
|
|
850
|
+
block_index=0,
|
|
851
|
+
mode=ProcessMode.COMPLETE
|
|
852
|
+
)
|
|
853
|
+
|
|
854
|
+
print(f"转换为交互块: {result1.transformed_to_interaction}")
|
|
855
|
+
print(f"生成的交互: {result1.content}")
|
|
856
|
+
|
|
857
|
+
if result1.transformed_to_interaction:
|
|
858
|
+
# 验证是否包含文本输入选项
|
|
859
|
+
has_text_input = "..." in result1.content
|
|
860
|
+
if has_text_input:
|
|
861
|
+
print("✅ 包含文本输入选项")
|
|
862
|
+
|
|
863
|
+
# 测试用户疑问式输入
|
|
864
|
+
print("\n--- 测试疑问式文本输入 ---")
|
|
865
|
+
question_input = ["这里必须要选择么?"]
|
|
866
|
+
|
|
867
|
+
result2 = mf.process(
|
|
868
|
+
block_index=0,
|
|
869
|
+
mode=ProcessMode.COMPLETE,
|
|
870
|
+
user_input={"风格选择": question_input},
|
|
871
|
+
dynamic_interaction_format=result1.content
|
|
872
|
+
)
|
|
873
|
+
|
|
874
|
+
print(f"用户疑问输入: {question_input}")
|
|
875
|
+
print(f"验证结果: {result2.variables}")
|
|
876
|
+
|
|
877
|
+
# 验证疑问输入的处理
|
|
878
|
+
result_value = result2.variables.get("风格选择")
|
|
879
|
+
if result_value == question_input or result_value == question_input[0]:
|
|
880
|
+
print("✅ 疑问式文本输入被接受(后续需LLM处理语义)")
|
|
881
|
+
print("📝 注意:语义验证应由LLM负责,固定代码只做格式验证")
|
|
882
|
+
else:
|
|
883
|
+
print(f"⚠️ 输入处理结果不符合预期: {result_value}")
|
|
884
|
+
|
|
885
|
+
# 测试其他类型的自定义输入
|
|
886
|
+
print("\n--- 测试其他自定义输入 ---")
|
|
887
|
+
custom_inputs = [
|
|
888
|
+
["我想要科幻加悬疑的混合风格"],
|
|
889
|
+
["可以不选择吗"],
|
|
890
|
+
["这些选项都不适合我"]
|
|
891
|
+
]
|
|
892
|
+
|
|
893
|
+
for custom_input in custom_inputs:
|
|
894
|
+
try:
|
|
895
|
+
result_custom = mf.process(
|
|
896
|
+
block_index=0,
|
|
897
|
+
mode=ProcessMode.COMPLETE,
|
|
898
|
+
user_input={"风格选择": custom_input},
|
|
899
|
+
dynamic_interaction_format=result1.content
|
|
900
|
+
)
|
|
901
|
+
print(f"自定义输入 '{custom_input[0]}' - 结果: {result_custom.variables.get('风格选择')}")
|
|
902
|
+
except Exception as e:
|
|
903
|
+
print(f"自定义输入 '{custom_input[0]}' - 错误: {str(e)[:50]}...")
|
|
904
|
+
|
|
905
|
+
print("✅ 用户疑问文本输入场景测试完成")
|
|
906
|
+
|
|
907
|
+
except Exception as e:
|
|
908
|
+
print(f"❌ 测试失败: {e}")
|
|
909
|
+
|
|
910
|
+
|
|
826
911
|
def run_all_tests():
|
|
827
912
|
"""运行所有 document_prompt 测试"""
|
|
828
913
|
print("🧪 开始 document_prompt 动态交互测试")
|
|
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
|