Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: refactor with pyo3 - rebuild thread and async method in rust #285

Open
Tracked by #197
HsiangNianian opened this issue Jul 4, 2024 · 0 comments
Open
Tracked by #197
Assignees
Labels
platform python Pull requests that update Python code
Milestone

Comments

@HsiangNianian
Copy link
Member

HsiangNianian commented Jul 4, 2024

The architecture of iamai

事件驱动—>规则驱动任务流

逻辑规则用于描述任务的条件与触发,执行流程仍保持在代码级别清晰透明。框架的主要任务是通过规则匹配逻辑动态组织任务执行顺序。

逻辑规则与求解目标

  • 最小逻辑单元(LogicUnit)

逻辑规则引擎

  • 逻辑推导式

回溯搜索

声明式编程

用户更多地描述“想要什么”,而非“如何实现”。

映射器 Mapper

  • 跨协议抽象

  • 引入字段映射器(Field Mapper)来完成 UDS 和具体协议字段的双向转换。

  • 任务流无关协议

改进与未来方向

  1. 领域聚焦: 专注于某些领域的任务流,比如:
    • 面向机器人交互逻辑。
    • 面向智能助手的行为逻辑。
    • 面向业务规则管理的动态工作流。
  2. 规则驱动进阶:
    • 将 Python 的规则匹配扩展为 Rust 后端运行,提高复杂逻辑判断性能。
    • 增加类似自然语言规则的接口,支持简单的非技术用户自定义逻辑。
  3. 工具链生态:
    • 提供任务流的可视化工具,帮助开发者调试和优化逻辑规则。
    • 支持逻辑单元的复用与共享(类似函数库),创建一个逻辑单元市场。
classDiagram
    class Mapper {
        <<abstract>>
        +start()
        +stop()
        +register_handler()
    }
    
    class TerminalMapper {
        +run_loop()
        -_input_handler()
    }
    
    class Message {
        +content: str
        +platform: str
        +user_id: str
    }
    
    class RulePlugin {
        <<abstract>>
        +match_rule(message) bool
        +execute_action(message) str
    }
    
    class RuleEngine {
        +plugins: list[RulePlugin]
        +register_plugin()
        +process_message()
    }
    
    Mapper <|-- TerminalMapper
    RuleEngine o-- RulePlugin
    TerminalMapper --> Message
    TerminalMapper --> RuleEngine
Loading
graph LR
    Python[Python Layer] -->|FFI调用| Rust[Rust Core]
    Python -->|插件开发| Python_Plugin[Python插件]
    Rust -->|高性能计算| Rule_Matching[规则匹配]
    Rust -->|零拷贝处理| Message_Processing[消息处理]
Loading
@HsiangNianian HsiangNianian added python Pull requests that update Python code todo labels Jul 4, 2024
@HsiangNianian HsiangNianian self-assigned this Jul 4, 2024
@HsiangNianian HsiangNianian mentioned this issue Nov 10, 2024
21 tasks
@HsiangNianian HsiangNianian moved this to In Progress in Development Nov 17, 2024
@HsiangNianian HsiangNianian moved this from Todo to In Progress in Features Requests Nov 17, 2024
@HsiangNianian HsiangNianian changed the title feat: refactor with pyo3 Refactor: rewrite with pyo3 Nov 18, 2024
@HsiangNianian HsiangNianian added this to the 1.0.0 milestone Nov 18, 2024
@HsiangNianian HsiangNianian pinned this issue Nov 18, 2024
@HsiangNianian HsiangNianian changed the title Refactor: rewrite with pyo3 RFC: refactor with pyo3 - rebuild thread and async method in rust Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform python Pull requests that update Python code
Projects
Status: In Progress
Status: In Progress
Development

No branches or pull requests

1 participant