[Bug]: Integers outside the Long range from the LLM become Double and lose precision

Đang mở
#83 0 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 1 ngày

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, kotlin
Lĩnh vực
backend

Hướng nghiên cứu

The conversion lives in JsonElement.toPrimitive() in the agent module's domain/JsonExtensions.kt, which tries toLongOrNull() then toDoubleOrNull(). Start there and reproduce with a number above Long.MAX_VALUE sent for a String parameter. Done when the literal digits reach the app function unchanged and existing number conversions still pass their tests.

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

Mô tả

Steps to Reproduce
  1. Have the model send an integer above Long.MAX_VALUE (e.g. an ID such as 12345678901234567890)
    for a String or string-array parameter.
Expected

The value reaches the app function exactly as the digits the model sent ("12345678901234567890").

Observed

"1.2345678901234567E19".

Root cause

JsonElement.toPrimitive() (agent/.../domain/JsonExtensions.kt) tries toLongOrNull() and then
toDoubleOrNull(), so big integers become Double. The raw JSON content is then lost before
type-aware conversion.

Suggested fix

Keep the raw JSON content for numbers that don't fit Long, for example as a String or BigDecimal. Or
convert with the parameter's metadata, so string parameters receive the literal digits.

Found during review of the #62 fix.

Ngôn ngữ chính
Kotlin
Star
222
Fork
54
Merge trung bình
1 ngày 11 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 android/appfunctions

Tất cả issue của android/appfunctions

Issue tương tự

Thêm issue về Kotlin

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.