AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

[Bug] Provider test shows success toast on failure

Open Fronut opened this issue 7 months ago • 0 comments

What happened / 发生了什么

Summary

  • When testing a provider with an invalid model name, the UI shows an “unavailable” status and error message, but also displays a “test success” toast with latency.
  • This is confusing because the same action reports both failure and success.
  • I have already written a PR to resolve this bug. You can check my PR.

Expected Result

  • Only a failure indication is shown (status is "unavailable" with the error message).
  • No success toast.

Actual Result

  • Status shows "unavailable" and the error message.
  • A success toast appears with latency. (See screenshot below)

Impact

Confusing UX: the same test action reports both failure and success.

Root Cause (analysis)

  • The API returns status=ok even when the provider test fails.
  • The UI path for non-chat providers treats status=ok as success without validating data.status or data.error.
  • This results in both the error status display and the success toast being triggered.

Reproduce / 如何复现?

  1. Open the Provider page.
  2. Add or edit an Embedding provider.
  3. Enter a valid API base URL and API key.
  4. Enter a non-existent model name.
  5. Save.
  6. Click Test.

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

4.23.6 Windows Docker

OS

Windows

Logs / 报错日志

[2026-05-01 14:35:27.390] [Core] [INFO] [provider.manager:764]: 终止 openai_embedding 提供商适配器(4, 0, 0) ...
[2026-05-01 14:35:27.395] [Core] [INFO] [provider.manager:791]: openai_embedding 提供商适配器已终止(4, 0, 0)
[2026-05-01 14:35:27.395] [Core] [INFO] [provider.manager:572]: 载入 openai_embedding(openai_embedding) 服务提供商 ...
[2026-05-01 14:35:27.395] [Core] [INFO] [sources.openai_embedding_source:35]: [OpenAI Embedding] openai_embedding Using API Base: https://api.acedata.cloud/v1
[2026-05-01 14:35:27.407] [Core] [INFO] [provider.manager:726]: providers in user's config: ['minimax-token-plan/MiniMax-M2.7', 'minimax-token-plan/MiniMax-M2.7-highspeed', 'deepseek/deepseek-v4-flash', 'deepseek/deepseek-v4-pro', 'openai_embedding']
[2026-05-01 14:35:28.397] [Core] [INFO] [routes.config:743]: API call: /config/provider/check_one id=openai_embedding
[2026-05-01 14:35:30.830] [Core] [WARN] [v4.23.6] [routes.config:712]: Provider openai_embedding (ID: openai_embedding) is unavailable. Error: Error code: 500 - {'trace_id': 'b1da34fd-0f9d-4729-bf00-192522702172', 'error': {'code': 'api_error', 'message': 'No valid account found'}}
Image

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • [x] Yes!

Code of Conduct

Fronut avatar May 01 '26 06:05 Fronut