anx-reader icon indicating copy to clipboard operation
anx-reader copied to clipboard

[Bug]: 版本1.10.1+6274,AI功能报错

Open bx33333 opened this issue 1 year ago • 13 comments

Prerequisites|前提条件

  • [x] I have checked the troubleshooting|我已经查看过故障排除
  • [x] I have searched for similar issues and did not find any|我已经搜索过没有相同的问题

Describe the bug|描述问题

我升级到1.10.1.beta2之后,AI功能基本不能使用了。我使用了gemini 2.5 flash和openRouter gpt-4o-mini,都分别报了不同的错误。我在升级之前,这两个ai都是正常的。 我在升级后,在设置中点击测试是正常的。 我清理了缓存问题依然存在。

To reproduce|重现步骤

  1. Go to '...' | 前往...
  2. Click on '...' | 点击...
  3. Scroll down to '...' | 向下滚动到...
  4. See error | 看到错误

Expected behavior|预期行为

期望AI能够正常使用。

Screenshots|截图

No response

Platform (please complete the following information)|平台(请填写以下信息)

  • Platform: | 平台:windows 11 [e.g. Android]
  • OS: | 操作系统:windows 11 [e.g. Android13(MIUI14)]
  • AnxReader Version: | 安读版本:1.10.1+6274 [e.g. 1.2.0+2033]
  • Device: | 设备:pc [e.g. Xiaomi 13]

Additional context|其他信息

No response

bx33333 avatar Dec 05 '25 13:12 bx33333

👋 感谢您提交bug报告!

我注意到您的平台信息可能不够完整。为了更好地帮助您解决问题,请提供以下完整信息:

  • Platform | 平台:(如: Android, iOS, Windows, macOS, Linux)
  • OS | 操作系统:(如: Android 13 (MIUI 14), iOS 17.1, Windows 11)
  • AnxReader Version | 安读版本:(如: 1.6.3+2100,可在应用设置中查看)
  • Device | 设备:(如: Xiaomi 13, iPhone 15, ThinkPad X1)

请编辑您的issue并填写完整的平台信息,这将帮助我们更快地定位和解决问题。


Thank you for submitting this bug report!

I noticed that your platform information might be incomplete. To better help you solve the issue, please provide complete information for:

  • Platform: (e.g., Android, iOS, Windows, macOS, Linux)
  • OS: (e.g., Android 13 (MIUI 14), iOS 17.1, Windows 11)
  • AnxReader Version: (e.g., 1.6.3+2100, check in app settings)
  • Device: (e.g., Xiaomi 13, iPhone 15, ThinkPad X1)

Please edit your issue and fill in the complete platform information to help us locate and resolve the issue faster.

github-actions[bot] avatar Dec 05 '25 13:12 github-actions[bot]

经测试,是由于AI工具中“列出标签”功能异常,可以暂时关闭此工具。

lcxqwe avatar Dec 05 '25 14:12 lcxqwe

可以提供下报错信息吗

Anxcye avatar Dec 06 '25 07:12 Anxcye

ℹ️ 需要更多信息 | More Information Required

为了更好地帮助您解决问题,我们需要更多详细信息。

请提供:

  • 详细的操作步骤
  • 错误信息的完整截图或日志
  • 问题出现的具体场景
  • 您的设备和软件版本信息
  • 任何可能相关的其他信息

请编辑您的原始issue或在评论中补充这些信息。


To better help you solve the issue, we need more detailed information.

Please provide:

  • Detailed steps to reproduce
  • Complete screenshots or logs of error messages
  • Specific scenarios where the issue occurs
  • Your device and software version information
  • Any other potentially relevant information

Please edit your original issue or add this information in the comments.

github-actions[bot] avatar Dec 06 '25 07:12 github-actions[bot]

gemini-2.5-flah Error: Invalid argument(s): Object schema must have "properties" property

chatgpt-4o-mini Error: OpenAIClientException({"uri": "https://openrouter.ai/api/v1/chat/completions","method": "POST","code": 400,"message": "Unsuccessful response","body": {"error": {"message": "Provider returned error","code": 400,"metadata": {"raw": "{\n \"error\": {\n \"message\": \"Invalid schema for function 'tags_list': In context=(), object schema missing properties.\",\n \"type\": \"invalid_request_error\",\n \"param\": \"tools12.function.parameters\",\n \"code\": \"invalid_function_parameters\"\n }\n}","provider_name": "OpenAI"}},"user_id": "user_36GYhcXMsbdTYHRCBtMiZmHTLZR"} })

bx33333 avatar Dec 06 '25 08:12 bx33333

Gemini: Error: Invalid argument(s): Object schema must have "properties" property

The error occurs during the conversion of the inputJsonSchema of the TagsListTool into the input schema used by the google_generative_ai package.
As the error states, the properties field is missing. It's the same error that occurs with ChatGPT.

For a tool that takes no parameters, we ideally should not have to provide any inputJsonSchema at all.
This is supported by Google’s package, but not by LangChain, which still requires a non-null schema (even in the latest version).

inputJsonSchema = const { 'type': 'string', 'nullable': true }
would work for Gemini, but not for ChatGPT, which strictly requires schemas where 'type' = 'object'.

A solution could be to send a schema accepted by both ChatGPT and Gemini, but one that they will effectively ignore:

inputJsonSchema: const {
  'type': 'object',
  'properties': {
    '_': {'type': 'string', 'nullable': true},
  },
},

Spixz avatar Dec 10 '25 14:12 Spixz

gemini-2.5-flah Error: Invalid argument(s): Object schema must have "properties" property

chatgpt-4o-mini Error: OpenAIClientException({"uri": "https://openrouter.ai/api/v1/chat/completions","method": "POST","code": 400,"message": "Unsuccessful response","body": {"error": {"message": "Provider returned error","code": 400,"metadata": {"raw": "{\n \"error\": {\n \"message\": \"Invalid schema for function 'tags_list': In context=(), object schema missing properties.\",\n \"type\": \"invalid_request_error\",\n \"param\": \"tools12.function.parameters\",\n \"code\": \"invalid_function_parameters\"\n }\n}","provider_name": "OpenAI"}},"user_id": "user_36GYhcXMsbdTYHRCBtMiZmHTLZR"} })

+1 同样的问题

esrever10 avatar Dec 11 '25 01:12 esrever10

Thanks a lot for the detailed analysis!

Your explanation about how inputJsonSchema is handled differently between Gemini and ChatGPT is extremely helpful. It makes sense that the missing properties field in a no‑parameter tool would cause schema validation issues across different providers, especially with LangChain still requiring a non-null schema.

The compatible schema you suggested looks like a solid direction. I’ll investigate this approach and adjust the TagsListTool accordingly to ensure it works consistently across models.

Anxcye avatar Dec 21 '25 13:12 Anxcye

I can confirm this issue is still present in the latest stable release.

Device: Google Pixel 10 Pro Fold OS: Android 16 (BP4A.251205.006.E1) App Version: 1.10.1+6279 Model Used: Gemini 2.5 Pro (via Google AI Studio key)

Error: Object schema must have "properties" property

Image

Behavior: Chat and "Explain" features crash immediately when "Enable AI Tools" is ON. Disabling tools works as a temporary workaround.

Click to expand: Crash Log (Stack Trace)
SEVERE^*^ 2026-01-17 18:21:08.462890^*^ [AI error: Error: Invalid argument(s): Object schema must have "properties" property
#0      SchemaMapper.toSchema (package:langchain_google/src/chat_models/google_ai/mappers.dart:329)
#1      ChatToolListMapper.toToolList.<anonymous closure> (package:langchain_google/src/chat_models/google_ai/mappers.dart:251)
#2      MappedIterable.elementAt (dart:_internal/iterable.dart:402)
#3      ListIterator.moveNext (dart:_internal/iterable.dart:371)
...
#9      ChatGoogleGenerativeAI._generateCompletionRequest (package:langchain_google/src/chat_models/google_ai/chat_google_generative_ai.dart:343)
#11     CancelableLangchainRunner.streamAgent.<anonymous closure> (package:anx_reader/service/ai/langchain_runner.dart:177)

TheSiskoDax avatar Jan 17 '26 23:01 TheSiskoDax

你好,已收到

lcxqwe avatar Jan 17 '26 23:01 lcxqwe

你好,已收到

I added logs to my comment

TheSiskoDax avatar Jan 17 '26 23:01 TheSiskoDax

fixed

Anxcye avatar Jan 29 '26 08:01 Anxcye

🔒 This issue has been locked because it has been closed for 30 days.

此 issue 已被锁定,因为它已关闭 30 天。

If you believe this issue should be reopened, please create a new issue and reference this one.

如果您认为此 issue 应该重新打开,请创建新的 issue 并引用此问题。

github-actions[bot] avatar Mar 01 '26 01:03 github-actions[bot]