Skip to content

Conversation

@go-wyvern
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings May 19, 2025 07:58
@go-wyvern go-wyvern changed the title feat(sprite): add functionality to add and search sprites from asset library feat(tools): add functionality to add and search sprites from asset library May 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds capabilities to import sprites from the asset library and search for sprites by keyword via Copilot-powered tools in the project editor.

  • Integrate getAsset/listAsset APIs and convert assets to sprites
  • Implement addSpriteFromAsset and searchSpriteFromAsset functions
  • Register two new Copilot tool descriptions and Zod schemas

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
spx-gui/src/components/editor/ProjectEditor.vue Added asset API imports, new functions for adding/searching sprites, and tool registration entries
spx-gui/src/components/copilot/mcp/definitions.ts Added Zod argument schemas and tool descriptions for sprite asset operations
Comments suppressed due to low confidence (3)

spx-gui/src/components/editor/ProjectEditor.vue:105

  • [nitpick] These new functions (addSpriteFromAsset and searchSpriteFromAsset) lack unit tests. Adding coverage will help validate asset integration logic and error handling.
async function addSpriteFromAsset(args:AddSpriteFromAssetOptions) {

spx-gui/src/components/copilot/mcp/definitions.ts:223

  • [nitpick] The tool description references "XBuilder" instead of "SPX" which may cause confusion. Align naming to the product terminology.
'Add a sprite (File) to the current XBuilder project workspace through asset',

spx-gui/src/components/editor/ProjectEditor.vue:110

  • The function selectAsset is neither imported nor defined in this file, leading to a runtime error. Consider importing it or invoking the correct selection helper from the editor context.
selectAsset(project.value, sprite)

Comment on lines 118 to 121
async function searchSpriteFromAsset(args:SearchSpriteFromAssetOptions) {
const assets = await listAsset({
pageSize: 3,
pageIndex: 1,
Copy link

Copilot AI May 19, 2025

Choose a reason for hiding this comment

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

[nitpick] Hard-coded pagination values (pageSize: 3, pageIndex: 1) reduce flexibility. Consider making these parameters configurable or documenting why these defaults were chosen.

Suggested change
async function searchSpriteFromAsset(args:SearchSpriteFromAssetOptions) {
const assets = await listAsset({
pageSize: 3,
pageIndex: 1,
async function searchSpriteFromAsset(args: SearchSpriteFromAssetOptions, pageSize = 3, pageIndex = 1) {
const assets = await listAsset({
pageSize: pageSize,
pageIndex: pageIndex,

Copilot uses AI. Check for mistakes.
@qiniu-ci
Copy link

This PR has been deployed to the preview environment. You can explore it using the preview URL.

Warning

Please note that deployments in the preview environment are temporary and will be automatically cleaned up after a certain period. Make sure to explore it before it is removed. For any questions, contact the Go+ Builder team.

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.

2 participants