callstack / callstack/ai-cli

feat: cost warning

Đang mở
#31 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
46
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Is your feature request related to a problem? Please describe.**
Currently there is a scenario when AI CLI can make expensive API call without user confirmation. This happens when user use `--file` option and asks a query in CLI params. In such case, even when the price threshold is exceeded and user gets a warning, he is not able to prevent this API call.

**Describe the solution you'd like**
In case file context is used, and user exceeds warning threshold for context and, and there is a query in CLI params: then CLI should ask user to confirm if it should make the API call before making it.

```shell-session
# ai -i --file file.md Some question
Using the provided file will increase conversation costs by $1.1193 per message.
Do you want to continue? [y/N]:
```

**Describe alternatives you've considered**
Warning as is, but there is a risk of making expensive API can which user would not want if he knew the costs.

**Additional context**
We should use current cost calculation features.
In rare case cost is not available, we should refer to token count.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi luồng tính toán chi phí và cảnh báo hiện có cho tùy chọn --file khi một truy vấn được cung cấp dưới dạng tham số CLI. Công việc hoàn tất khi việc vượt quá ngưỡng chi phí ngữ cảnh yêu cầu xác nhận trước khi gọi API, sử dụng số lượng token khi không có chi phí.

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

Đánh giá

Công nghệ
typescript
Lĩnh vực
ai, cli
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

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.