Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion astrbot/core/computer/tools/neo_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class CreateSkillPayloadTool(NeoSkillToolBase):
"type": "object",
"properties": {
"payload": {
"anyOf": [{"type": "object"}, {"type": "array"}],
"anyOf": [{"type": "object"}, {"type": "array", "items": {"type": "object"}}],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): Tightening the JSON schema to array of object may be a breaking change for existing payloads.

Previously, any array payload was valid; now only arrays of objects will pass validation. If existing skills send arrays of primitives (e.g., strings or numbers), they’ll start failing. If that’s intentional, consider auditing current payloads or planning a migration; if not, you may want to keep the array less constrained or broaden the items schema.

"description": (
"Skill payload JSON. Typical schema: {skill_markdown, inputs, outputs, meta}. "
"This only stores content and returns payload_ref; it does not create a candidate or release."
Expand Down
6 changes: 3 additions & 3 deletions astrbot/core/provider/sources/openai_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ async def _query_stream(
state.handle_chunk(chunk)
except Exception as e:
logger.warning("Saving chunk state error: " + str(e))
if len(chunk.choices) == 0:
if not chunk.choices:
continue
delta = chunk.choices[0].delta
# logger.debug(f"chunk delta: {delta}")
Expand Down Expand Up @@ -345,7 +345,7 @@ def _extract_reasoning_content(
) -> str:
"""Extract reasoning content from OpenAI ChatCompletion if available."""
reasoning_text = ""
if len(completion.choices) == 0:
if not completion.choices:
return reasoning_text
if isinstance(completion, ChatCompletion):
choice = completion.choices[0]
Expand Down Expand Up @@ -468,7 +468,7 @@ async def _parse_openai_completion(
"""Parse OpenAI ChatCompletion into LLMResponse"""
llm_response = LLMResponse("assistant")

if len(completion.choices) == 0:
if not completion.choices:
raise Exception("API 返回的 completion 为空。")
choice = completion.choices[0]

Expand Down