Skip to content

Conversation

@Soulter
Copy link
Member

@Soulter Soulter commented Sep 21, 2025

closes: #2821


Motivation / 动机

fix: 识别引用消息的图片时优先使用默认图片转述提供商

closes: #2821

Modifications / 改动点

fix: 识别引用消息的图片时优先使用默认图片转述提供商

closes: #2821

Verification Steps / 验证步骤

配置使用默认图片转述提供商,然后在 QQ 中引用带有图片的消息

Screenshots or Test Results / 运行截图或测试结果

image

Compatibility & Breaking Changes / 兼容性与破坏性变更

  • 这是一个破坏性变更 (Breaking Change)。/ This is a breaking change.
  • 这不是一个破坏性变更。/ This is NOT a breaking change.

Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

@auto-assign auto-assign bot requested review from Larch-C and anka-afk September 21, 2025 11:01
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好 - 我已经审阅了你的修改,它们看起来很棒!

AI 代理的提示
请解决此代码审查中的评论:

## 单独的评论

### 评论 1
<location> `packages/astrbot/main.py:1323-1324` </location>
<code_context>
+                        prov = self.context.get_using_provider(
+                            event.unified_msg_origin
+                        )
+                    if prov:
                         llm_resp = await prov.text_chat(
                             prompt="Please describe the image content.",
                             image_urls=[await image_seg.convert_to_file_path()],
</code_context>

<issue_to_address>
**suggestion:** 考虑处理 `prov` 在两次查找后仍然为 `None` 的情况。

如果两次查找都失败,请添加一个 `else` 分支来处理或记录这种情况,因为这可能预示着配置或运行时问题。
</issue_to_address>

Sourcery 对开源项目免费 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我变得更有用!请点击每个评论上的 👍 或 👎,我将利用这些反馈来改进你的评论。
Original comment in English

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `packages/astrbot/main.py:1323-1324` </location>
<code_context>
+                        prov = self.context.get_using_provider(
+                            event.unified_msg_origin
+                        )
+                    if prov:
                         llm_resp = await prov.text_chat(
                             prompt="Please describe the image content.",
                             image_urls=[await image_seg.convert_to_file_path()],
</code_context>

<issue_to_address>
**suggestion:** Consider handling the case where prov is still None after both lookups.

If both lookups fail, add an else branch to handle or log this case, as it could signal a configuration or runtime problem.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Soulter Soulter merged commit 7a5bc51 into master Sep 21, 2025
5 checks passed
@Soulter Soulter deleted the fix/2821 branch September 21, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]图片转述模型无法识别QQ引用消息

2 participants