Skip to content

fix(chat): keep an explicitly empty quick-prompt list empty - #3172

Closed
ningblue wants to merge 1 commit into
TencentCloud:developfrom
ningblue:fix/chat-explicit-empty-quick-prompts
Closed

ningblue wants to merge 1 commit into
TencentCloud:developfrom
ningblue:fix/chat-explicit-empty-quick-prompts

Conversation

@ningblue

Copy link
Copy Markdown

Summary

An expert whose workspace manifest.json carries quick_prompts: [] currently opens with the default quick cards. The welcome endpoint only treats the manifest as authorial intent when it has content, so an explicit empty list falls through to default_welcome_payload(). That makes "this expert has no quick-start cards" impossible to express, although task_examples: [] already means "no cards".

This change treats a quick_prompts list as final even when it is empty. A missing or non-list value still uses the defaults.

  • get_chat_welcome now resolves the payload through workspace_welcome_payload().
  • The manifest's task_examples, the row-level welcome_message, and team hosts are unchanged.
  • docs/expert-package.md and CHANGELOG.md updated.

Target branch

  • Base is develop (feature / fix — default)

Type of change

  • Bug fix

Test plan

  • pytest tests/unit/api/test_chat_welcome_cards.py tests/unit/api/test_chat_welcome.py -q → 23 passed
  • ruff check and ruff format --check on the changed files
  • mypy --strict src/octop/api/routers/chat/routes.py → no issues
  • New tests cover: no key → defaults, cards kept, [] → no cards, null / text → defaults
  • Full make all left to CI

Checklist

  • Added/updated tests
  • Updated CHANGELOG.md
  • README / docs updated (if needed)

An expert manifest with `quick_prompts: []` was treated like a manifest
that says nothing about cards, so the chat welcome endpoint fell back to
the default card set and every such expert opened with generic cards.

A `quick_prompts` list is the author's decision even when empty; only a
missing or malformed value uses the defaults. This matches the existing
`task_examples` empty-array behavior.

Tests: tests/unit/api/test_chat_welcome_cards.py (new).
@github-actions

Copy link
Copy Markdown
Contributor

This pull request was closed by a temporary author restriction.

Pull requests may only be opened by:

  • users who already have a merged pull request in this repository
  • users with admin, maintain, or write access
  • users listed in .github/pr-author-allowlist.txt or the PR_AUTHOR_ALLOWLIST repository variable

Ask a maintainer to add your GitHub login to that allowlist, then reopen the pull request.


此 Pull Request 已被临时的作者限制自动关闭。

当前仅允许以下用户创建 PR:

  • 已有 Pull Request 被合入本仓库的贡献者
  • 拥有 admin、maintain 或 write 权限的用户
  • 写在 .github/pr-author-allowlist.txt 或仓库变量 PR_AUTHOR_ALLOWLIST 中的用户

如需在首次合入前贡献,请联系维护者把 GitHub 用户名加入允许名单,然后再重新打开这个 PR。

维护者可将仓库变量 PR_AUTHOR_GUARD 设为 off 以关闭此限制。

@ningblue

Copy link
Copy Markdown
Author

Allowlist request with the branch and test evidence: #3173. The change is ready; please reopen after the guard is lifted for this account.

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.

1 participant