Spaces:
Sleeping
Sleeping
File size: 1,277 Bytes
a25ea1a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #!/usr/bin/env python
# coding: utf-8
"""
基本推理示例 - 展示BasicResponseLogic的基本用法
"""
import sys
import os
import time
# 將项目根目錄添加到路徑中,方便導入模組
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from logic_core import BasicResponseLogic, Config, ReportGenerator
def main():
print("="*60)
print("BasicResponseLogic 基本推理示例")
print("="*60)
# 初始化配置
config = Config(timestamp="2025-03-12T00:00:00", debug_mode=True)
# 初始化推理引擎
engine = BasicResponseLogic()
# 測試輸入
test_inputs = [
"請分析未來市場趨勢並給出建議",
"我需要了解最新的技術發展方向",
"如何優化現有產品的用戶體驗"
]
for input_text in test_inputs:
print(f"\n{'='*60}\n處理輸入: {input_text}\n{'='*60}")
# 執行推理
result = engine.run(input_text, config)
# 生成報告
report = ReportGenerator(result).generate_report(format="text")
# 顯示結果
print(report)
# 暫停一下,避免輸出太快
time.sleep(1)
if __name__ == "__main__":
main() |