Skip to content
Open
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
15 changes: 8 additions & 7 deletions .github/workflows/code-reviewer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ permissions:

on:
pull_request:
types: [opened]
branches:
- master
pull_request_review_comment:
types: [created]

concurrency:
group: ${{ github.repository }}-${{ github.event.number || github.head_ref ||
Expand All @@ -21,20 +20,22 @@ jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: blocklet/aigne-code-reviewer@v0.1.14
- uses: aigne-io/aigne-codesmith@v0.1.0
Copy link

Choose a reason for hiding this comment

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

Image description AIGNE CodeSmith

使用固定版本号可能会错过重要的安全更新,建议使用语义化版本范围:

- uses: aigne-io/aigne-codesmith@v0.1.0
+ uses: aigne-io/aigne-codesmith@^0.1.0

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
DEBUG: "@aigne/*"
DEBUG: '@aigne/*'
Comment on lines 24 to +27
Copy link

Choose a reason for hiding this comment

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

Image description AIGNE CodeSmith

缩进不一致会导致YAML解析错误:

- env:
-  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-   ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
-  DEBUG: '@aigne/*'
+ env:
+   GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+   ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
+   DEBUG: '@aigne/*'

with:
debug: true
language: "zh-CN"
language: 'zh-CN'
disable_review: false
review_simple_changes: false
review_comment_lgtm: false
disable_review: true
path_filters: |
!core/types/**
!core/schema/lib/**
!core/proto/lib/**
!**/types.js
!**/package.json
Comment on lines 28 to +39
Copy link

Choose a reason for hiding this comment

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

Image description AIGNE CodeSmith

缩进问题同样存在于with部分,需要统一缩进风格:

 with:
-   debug: true
-  language: 'zh-CN'
-  disable_review: false
-   review_simple_changes: false
-   review_comment_lgtm: false
-   path_filters: |
-     !core/types/**
-     !core/schema/lib/**
-    !core/proto/lib/**
-     !**/types.js
-    !**/package.json
+   debug: true
+   language: 'zh-CN'
+   disable_review: false
+   review_simple_changes: false
+   review_comment_lgtm: false
+   path_filters: |
+     !core/types/**
+     !core/schema/lib/**
+     !core/proto/lib/**
+     !**/types.js
+     !**/package.json

!**/*.d.ts
!**/*.lock
16 changes: 16 additions & 0 deletions blocklets/image-bin/api/sdk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const Auth = require('@blocklet/sdk/service/auth');

const auth = new Auth();
Copy link

Choose a reason for hiding this comment

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

Image description AIGNE CodeSmith

建议添加配置参数:

- const auth = new Auth();
+ const auth = new Auth({
+   timeout: 5000,  // 设置超时时间
+   retries: 3      // 设置重试次数
+ });


(async () => {
let result = await auth.createAccessKey({
remark: 'from-cli',
});
console.log(result.data);

result = await auth.verifyAccessKey({
accessKeyId: result.data.accessKeySecret,
});
Comment on lines +12 to +13
Copy link

Choose a reason for hiding this comment

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

Image description AIGNE CodeSmith

验证密钥时需要同时提供 accessKeyId 和 accessKeySecret:

-    accessKeyId: result.data.accessKeySecret,
+    accessKeyId: result.data.accessKeyId,
+    accessKeySecret: result.data.accessKeySecret


console.log(result.data);
})();
Comment on lines +5 to +16
Copy link

Choose a reason for hiding this comment

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

Image description AIGNE CodeSmith

这段代码存在几个重要问题:

  1. 缺少错误处理:
 (async () => {
+  try {
     let result = await auth.createAccessKey({
       remark: 'from-cli',
     });
     console.log(result.data);
 
     result = await auth.verifyAccessKey({
       accessKeyId: result.data.accessKeySecret,
     });
 
     console.log(result.data);
+  } catch (err) {
+    console.error('身份验证失败:', err);
+    process.exit(1);
+  }
 })();
  1. 验证密钥时使用了错误的参数:
     result = await auth.verifyAccessKey({
-      accessKeyId: result.data.accessKeySecret,
+      accessKeyId: result.data.accessKeyId,
+      accessKeySecret: result.data.accessKeySecret
     });

Loading