Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add `condition` to `halt_after` / `halt_before`

Đang mở
#436 11 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Bắt đầu bằng cách xác định phần triển khai và các bài kiểm thử cho app.run, halt_after và halt_before. Theo dõi cách các danh sách hành động hiện tại kích hoạt việc dừng, sau đó xác định phạm vi kiểm thử cho các mục có điều kiện và không điều kiện; công việc được hoàn tất khi việc dừng chỉ xảy ra khi điều kiện được cung cấp được đáp ứng, trong khi hành vi hiện có vẫn không thay đổi khi không cung cấp điều kiện.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area/core kind/feature priority/low

Is your feature request related to a problem? Please describe.
Currently, it is not possible to halt the app after a given action iff a condition is met. Here is a motivating example of when it might be needed:

Say you have a chatgpt-like app with various "chats", where each chat is a distinct burr app. When a user starts a new chat, you'd like to have a quick routing step that will detect, based on the first prompt, if the new chat is actually the continuation of a previous chat. If so, we want to halt the current app and restart the relevant app. If not, the app can continue its normal lifecycle.

Describe the solution you'd like
Instead of providing a list of actions to halt_after (or halt_before), provide a list of tuples (action, condition). The application will halt after a given action if and only if condition is met. If no condition is provided, the app will always halt after action is processed (current behavior).

Describe alternatives you've considered
Right now, the alternative is to have a dummy action to halt on and a conditional transition to it.

with_transitions(
    ("routing_action", "continue_action", when(continue=True)),
    ("routing_action, "halt_action", when(continue=False))
)

And then when calling app.run:

final_action, result, final_state = app.run(
            halt_after=["halt_action"],
            inputs={"prompt" : user_input}
        )

This is less clean than the suggested API.

Another possible way to address this would be to enable halting the application from within an action, although it may be harder to implement.

Ngôn ngữ chính
Python
Star
2.6k
Fork
208
Merge trung bình
6 ngày 7 giờ
Pull request đã merge (30 ngày)
26

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/burr

Tất cả issue của apache/burr

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.