@cnbcool/cnb-cli 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/package.json +4 -2
  2. package/skills/cnb-api/scripts/core/flat-options.json +8909 -0
  3. package/skills/cnb-api/scripts/core/help.json +704 -704
  4. package/skills/cnb-api/scripts/core/index.js +33 -455
  5. package/skills/cnb-api/scripts/core/key-mapping.json +538 -0
  6. package/skills/cnb-api/scripts/core/lib/execute-action.js +97 -0
  7. package/skills/cnb-api/scripts/core/lib/extra-help.js +20 -0
  8. package/skills/cnb-api/scripts/core/lib/flat-options-data.js +16 -0
  9. package/skills/cnb-api/scripts/core/lib/format-output.js +85 -0
  10. package/skills/cnb-api/scripts/core/lib/format-params.js +211 -0
  11. package/skills/cnb-api/scripts/core/lib/help-data.js +15 -0
  12. package/skills/cnb-api/scripts/core/lib/key-mapping-data.js +16 -0
  13. package/skills/cnb-api/scripts/core/lib/parsers.js +126 -0
  14. package/skills/cnb-api/scripts/core/lib/print-json.js +15 -0
  15. package/skills/cnb-api/scripts/core/lib/register-fallback.js +15 -0
  16. package/skills/cnb-api/scripts/core/lib/register-modules.js +91 -0
  17. package/skills/cnb-api/scripts/core/lib/summary-extractors.js +181 -0
  18. package/skills/cnb-api/scripts/core/lib/trim-summary.js +17 -0
  19. package/skills/cnb-api/scripts/core/shortcuts.js +10 -186
  20. package/skills/cnb-api/scripts/core/utils/build-nested-field-map.js +35 -0
  21. package/skills/cnb-api/scripts/core/utils/flat-key-from-segments.js +14 -0
  22. package/skills/cnb-api/scripts/core/utils/match-array-object-field.js +25 -0
  23. package/skills/cnb-api/scripts/core/utils/restore-original-keys.js +24 -0
  24. package/skills/cnb-api/scripts/core/utils/upload.js +107 -15
  25. package/skills/cnb-api/scripts/modules/knowledge-base/search-npc.js +5 -5
@@ -2,8 +2,8 @@
2
2
  "mainHelp": {
3
3
  "event": 1,
4
4
  "organizations": 12,
5
- "knowledge-base": 5,
6
5
  "rank": 5,
6
+ "knowledge-base": 5,
7
7
  "search": 1,
8
8
  "users": 6,
9
9
  "issues": 24,
@@ -1318,28 +1318,48 @@
1318
1318
  }
1319
1319
  }
1320
1320
  },
1321
- "knowledge-base": {
1322
- "search-npc": {
1323
- "path": "/npc/search",
1321
+ "rank": {
1322
+ "get-repo-annual-rank": {
1323
+ "path": "/ranks/repo/annual",
1324
1324
  "method": "get",
1325
- "category": "knowledge-base",
1326
- "filename": "search-npc",
1327
- "summary": "全局语义搜索 NPC 角色",
1328
- "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r,repo-code:r",
1329
- "permission": "repo-basic-info:r,repo-code:r",
1325
+ "category": "rank",
1326
+ "filename": "get-repo-annual-rank",
1327
+ "summary": "获取公仓年榜",
1328
+ "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r",
1329
+ "permission": "repo-basic-info:r",
1330
1330
  "help": {
1331
1331
  "parameter": {
1332
1332
  "query": {
1333
- "key": {
1333
+ "language": {
1334
1334
  "type": "string",
1335
- "description": "搜索关键词",
1336
- "name": "key",
1337
- "required": true
1335
+ "default": "all-languages",
1336
+ "description": "语言",
1337
+ "name": "language",
1338
+ "required": false
1338
1339
  },
1339
- "top_n": {
1340
+ "flags": {
1341
+ "type": "string",
1342
+ "description": "仓库类型",
1343
+ "name": "flags",
1344
+ "required": false,
1345
+ "enum": [
1346
+ "KnowledgeBase",
1347
+ "NPC",
1348
+ "Skills"
1349
+ ]
1350
+ },
1351
+ "year": {
1352
+ "type": "string",
1353
+ "default": "",
1354
+ "description": "年榜年份,格式为2006,不填默认为本年",
1355
+ "name": "year",
1356
+ "required": false
1357
+ },
1358
+ "topN": {
1340
1359
  "type": "number",
1341
- "description": "返回结果数量,最大20",
1342
- "name": "top_n",
1360
+ "default": 100,
1361
+ "description": "排行前n名",
1362
+ "name": "topN",
1343
1363
  "required": false
1344
1364
  }
1345
1365
  }
@@ -1352,411 +1372,277 @@
1352
1372
  "items": {
1353
1373
  "type": "object",
1354
1374
  "properties": {
1355
- "avatar": {
1375
+ "created_at": {
1356
1376
  "type": "string"
1357
1377
  },
1358
- "name": {
1378
+ "description": {
1359
1379
  "type": "string"
1360
1380
  },
1361
- "repo_id": {
1362
- "type": "number"
1381
+ "display_module": {
1382
+ "type": "object",
1383
+ "properties": {
1384
+ "activity": {
1385
+ "type": "boolean",
1386
+ "description": "仓库动态"
1387
+ },
1388
+ "contributors": {
1389
+ "type": "boolean",
1390
+ "description": "仓库贡献者"
1391
+ },
1392
+ "release": {
1393
+ "type": "boolean",
1394
+ "description": "仓库版本"
1395
+ }
1396
+ }
1363
1397
  },
1364
- "score": {
1398
+ "flags": {
1399
+ "type": "string",
1400
+ "enum": [
1401
+ "Unknown",
1402
+ "KnowledgeBase",
1403
+ "NPC",
1404
+ "Skills",
1405
+ "Wiki"
1406
+ ],
1407
+ "x-enum-descriptions": [
1408
+ "Unknown 未知",
1409
+ "KnowledgeBase 知识库",
1410
+ "NPC NPC",
1411
+ "Skills 技能",
1412
+ "Wiki Wiki"
1413
+ ]
1414
+ },
1415
+ "fork_count": {
1365
1416
  "type": "number"
1366
1417
  },
1367
- "slogan": {
1368
- "type": "string"
1369
- }
1370
- }
1371
- }
1372
- }
1373
- },
1374
- "400": {
1375
- "description": "Bad Request",
1376
- "schema": {
1377
- "type": "object"
1378
- }
1379
- },
1380
- "500": {
1381
- "description": "Internal Server Error",
1382
- "schema": {
1383
- "type": "object"
1384
- }
1385
- }
1386
- }
1387
- }
1388
- },
1389
- "get-knowledge-base-info": {
1390
- "path": "/{repo}/-/knowledge/base",
1391
- "method": "get",
1392
- "category": "knowledge-base",
1393
- "filename": "get-knowledge-base-info",
1394
- "summary": "获取知识库信息",
1395
- "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-code:r",
1396
- "permission": "repo-code:r",
1397
- "help": {
1398
- "parameter": {
1399
- "path": {
1400
- "repo": {
1401
- "type": "string",
1402
- "description": "repo",
1403
- "name": "repo",
1404
- "required": true
1405
- }
1406
- }
1407
- },
1408
- "response": {
1409
- "200": {
1410
- "description": "OK",
1411
- "schema": {
1412
- "type": "object",
1413
- "properties": {
1414
- "embedding_model": {
1415
- "type": "object",
1416
- "properties": {
1417
- "dimension": {
1418
- "type": "number"
1418
+ "forked_from_repo": {
1419
+ "type": "object",
1420
+ "properties": {
1421
+ "created_at": {
1422
+ "type": "string"
1423
+ },
1424
+ "freeze": {
1425
+ "type": "boolean"
1426
+ },
1427
+ "path": {
1428
+ "type": "string"
1429
+ },
1430
+ "resource_id": {
1431
+ "type": "number"
1432
+ },
1433
+ "resource_type": {
1434
+ "type": "number",
1435
+ "enum": [
1436
+ 0,
1437
+ 1,
1438
+ 2,
1439
+ 3,
1440
+ 4
1441
+ ],
1442
+ "x-enum-descriptions": [
1443
+ "SlugTypeGroup 分组",
1444
+ "SlugTypeRepo 仓库",
1445
+ "SlugTypeMission 任务集",
1446
+ "SlugTypeRegistry ",
1447
+ "SlugTypeUnknown unknown"
1448
+ ]
1449
+ },
1450
+ "root_freeze": {
1451
+ "type": "boolean"
1452
+ },
1453
+ "root_id": {
1454
+ "type": "number"
1455
+ },
1456
+ "updated_at": {
1457
+ "type": "string"
1458
+ }
1419
1459
  },
1420
- "name": {
1421
- "type": "string"
1422
- }
1423
- }
1424
- },
1425
- "exclude": {
1426
- "type": "string"
1427
- },
1428
- "id": {
1429
- "type": "string"
1430
- },
1431
- "include": {
1432
- "type": "string"
1433
- },
1434
- "issue_last_sync_time": {
1435
- "type": "string"
1436
- },
1437
- "issue_sync_enabled": {
1438
- "type": "boolean"
1439
- },
1440
- "last_commit_sha": {
1441
- "type": "string"
1442
- },
1443
- "metadata": {
1444
- "type": "object",
1445
- "properties": {
1446
- "issue": {
1447
- "type": "object",
1448
- "properties": {
1449
- "exclude_labels": {
1450
- "type": "string",
1451
- "description": "逗号分隔的排除标签字符串"
1452
- },
1453
- "labels": {
1454
- "type": "string",
1455
- "description": "逗号分隔的标签字符串,如 \"bug,feature\""
1456
- },
1457
- "state": {
1458
- "type": "string",
1459
- "description": "\"open\", \"closed\""
1460
- }
1460
+ "description": "预留"
1461
+ },
1462
+ "freeze": {
1463
+ "type": "boolean"
1464
+ },
1465
+ "id": {
1466
+ "type": "string"
1467
+ },
1468
+ "increase_fork": {
1469
+ "type": "number"
1470
+ },
1471
+ "increase_star": {
1472
+ "type": "number"
1473
+ },
1474
+ "language": {
1475
+ "type": "string",
1476
+ "description": "仓库程序语言,预留"
1477
+ },
1478
+ "languages": {
1479
+ "type": "object",
1480
+ "properties": {
1481
+ "color": {
1482
+ "type": "string"
1483
+ },
1484
+ "language": {
1485
+ "type": "string"
1461
1486
  }
1462
1487
  },
1463
- "processing": {
1464
- "type": "object",
1465
- "properties": {
1466
- "chunk_overlap": {
1467
- "type": "number"
1468
- },
1469
- "chunk_size": {
1470
- "type": "number"
1471
- },
1472
- "text_separator": {
1473
- "type": "string"
1474
- }
1488
+ "description": "仓库语言"
1489
+ },
1490
+ "last_update_nickname": {
1491
+ "type": "string",
1492
+ "description": "最新代码更新人姓名"
1493
+ },
1494
+ "last_update_username": {
1495
+ "type": "string",
1496
+ "description": "最新代码更新人账户名"
1497
+ },
1498
+ "last_updated_at": {
1499
+ "type": "object",
1500
+ "properties": {
1501
+ "time": {
1502
+ "type": "string"
1503
+ },
1504
+ "valid": {
1505
+ "type": "boolean",
1506
+ "description": "Valid is true if Time is not NULL"
1475
1507
  }
1476
1508
  },
1477
- "version": {
1478
- "type": "string"
1479
- }
1480
- }
1481
- },
1482
- "statistics": {
1483
- "type": "object",
1484
- "properties": {
1485
- "count": {
1486
- "type": "number"
1509
+ "description": "最新代码更新时间"
1510
+ },
1511
+ "license": {
1512
+ "type": "string"
1513
+ },
1514
+ "mark_count": {
1515
+ "type": "number"
1516
+ },
1517
+ "name": {
1518
+ "type": "string"
1519
+ },
1520
+ "npc_builded_count": {
1521
+ "type": "number"
1522
+ },
1523
+ "npc_created_pull_count": {
1524
+ "type": "number"
1525
+ },
1526
+ "npc_merged_pull_count": {
1527
+ "type": "number"
1528
+ },
1529
+ "open_issue_count": {
1530
+ "type": "number",
1531
+ "description": "开启的issue数"
1532
+ },
1533
+ "open_pull_request_count": {
1534
+ "type": "number",
1535
+ "description": "开启的pull request数"
1536
+ },
1537
+ "path": {
1538
+ "type": "string",
1539
+ "description": "完整仓库路径"
1540
+ },
1541
+ "second_languages": {
1542
+ "type": "object",
1543
+ "properties": {
1544
+ "color": {
1545
+ "type": "string"
1546
+ },
1547
+ "language": {
1548
+ "type": "string"
1549
+ }
1487
1550
  },
1488
- "size": {
1489
- "type": "number"
1551
+ "description": "第二语言"
1552
+ },
1553
+ "site": {
1554
+ "type": "string"
1555
+ },
1556
+ "star_count": {
1557
+ "type": "number"
1558
+ },
1559
+ "stared": {
1560
+ "type": "boolean"
1561
+ },
1562
+ "status": {
1563
+ "type": "number"
1564
+ },
1565
+ "tags": {
1566
+ "type": "array",
1567
+ "items": {
1568
+ "name": {
1569
+ "type": "string"
1570
+ }
1490
1571
  }
1572
+ },
1573
+ "topics": {
1574
+ "type": "string"
1575
+ },
1576
+ "updated_at": {
1577
+ "type": "string"
1578
+ },
1579
+ "visibility_level": {
1580
+ "type": "string",
1581
+ "enum": [
1582
+ "Private",
1583
+ "Public",
1584
+ "Secret"
1585
+ ],
1586
+ "x-enum-descriptions": [
1587
+ "VisibilityPrivate 私有仓库 - 仓库的访问必须显式授予每个用户",
1588
+ "VisibilityPublic 公共仓库 - 可以不经任何身份验证克隆该项目",
1589
+ "VisibilitySecret 加密仓库 - 仓库特定角色身份才能读取解密"
1590
+ ]
1591
+ },
1592
+ "web_url": {
1593
+ "type": "string"
1594
+ },
1595
+ "weight_score": {
1596
+ "type": "number"
1491
1597
  }
1492
1598
  }
1493
1599
  }
1494
1600
  }
1495
- },
1496
- "404": {
1497
- "description": "Not Found",
1498
- "schema": {
1499
- "type": "object"
1500
- }
1501
- },
1502
- "500": {
1503
- "description": "Internal Server Error",
1504
- "schema": {
1505
- "type": "object"
1506
- }
1507
1601
  }
1508
1602
  }
1509
1603
  }
1510
1604
  },
1511
- "delete-knowledge-base": {
1512
- "path": "/{repo}/-/knowledge/base",
1513
- "method": "delete",
1514
- "category": "knowledge-base",
1515
- "filename": "delete-knowledge-base",
1516
- "summary": "删除知识库",
1517
- "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-code:rw",
1518
- "permission": "repo-code:rw",
1605
+ "get-repo-daily-rank": {
1606
+ "path": "/ranks/repo/daily",
1607
+ "method": "get",
1608
+ "category": "rank",
1609
+ "filename": "get-repo-daily-rank",
1610
+ "summary": "获取公仓日榜",
1611
+ "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r",
1612
+ "permission": "repo-basic-info:r",
1519
1613
  "help": {
1520
1614
  "parameter": {
1521
- "path": {
1522
- "repo": {
1615
+ "query": {
1616
+ "language": {
1523
1617
  "type": "string",
1524
- "description": "repo",
1525
- "name": "repo",
1526
- "required": true
1527
- }
1528
- }
1529
- },
1530
- "response": {
1531
- "200": {
1532
- "description": "OK",
1533
- "schema": {
1534
- "type": "object"
1535
- }
1536
- },
1537
- "404": {
1538
- "description": "Not Found",
1539
- "schema": {
1540
- "type": "object"
1541
- }
1542
- },
1543
- "500": {
1544
- "description": "Internal Server Error",
1545
- "schema": {
1546
- "type": "object"
1547
- }
1548
- }
1549
- }
1550
- }
1551
- },
1552
- "query-knowledge-base": {
1553
- "path": "/{repo}/-/knowledge/base/query",
1554
- "method": "post",
1555
- "category": "knowledge-base",
1556
- "filename": "query-knowledge-base",
1557
- "summary": "查询知识库,使用文档:https://docs.cnb.cool/zh/ai/knowledge-base.html",
1558
- "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-code:r",
1559
- "permission": "repo-code:r",
1560
- "help": {
1561
- "parameter": {
1562
- "path": {
1563
- "repo": {
1564
- "type": "string",
1565
- "description": "repo",
1566
- "name": "repo",
1567
- "required": true
1568
- }
1569
- },
1570
- "body": {
1571
- "description": "查询内容",
1572
- "name": "query",
1573
- "required": true,
1574
- "schema": {
1575
- "type": "object",
1576
- "properties": {
1577
- "metadata_filtering_conditions": {
1578
- "type": "object",
1579
- "properties": {
1580
- "conditions": {
1581
- "type": "array",
1582
- "items": {
1583
- "properties": {
1584
- "comparison_operator": {
1585
- "type": "string",
1586
- "description": "运算符: \"is\", \"is not\", \"contains\", \"not contains\", \"starts with\", \"ends with\", \"is empty\", \"is not empty\""
1587
- },
1588
- "name": {
1589
- "type": "string",
1590
- "description": "字段名称: \"position\", \"path\", \"type\""
1591
- },
1592
- "value": {
1593
- "type": "string",
1594
- "description": "比较值(\"is empty\" 和 \"is not empty\" 时忽略此字段)"
1595
- }
1596
- }
1597
- }
1598
- },
1599
- "logical_operator": {
1600
- "type": "string",
1601
- "description": "\"and\" 或 \"or\",默认 \"and\""
1602
- }
1603
- },
1604
- "description": "元数据过滤条件"
1605
- },
1606
- "query": {
1607
- "type": "string",
1608
- "description": "查询语句"
1609
- },
1610
- "score_threshold": {
1611
- "type": "number",
1612
- "description": "分数阈值"
1613
- },
1614
- "top_k": {
1615
- "type": "number",
1616
- "description": "返回结果的数量"
1617
- }
1618
- }
1619
- }
1620
- }
1621
- },
1622
- "response": {
1623
- "200": {
1624
- "description": "OK",
1625
- "schema": {
1626
- "type": "array",
1627
- "items": {
1628
- "type": "object",
1629
- "properties": {
1630
- "chunk": {
1631
- "type": "string"
1632
- },
1633
- "metadata": {
1634
- "type": "object",
1635
- "properties": {
1636
- "type": "object",
1637
- "additionalProperties": {
1638
- "type": "any"
1639
- }
1640
- }
1641
- },
1642
- "score": {
1643
- "type": "number"
1644
- }
1645
- }
1646
- }
1647
- }
1648
- },
1649
- "400": {
1650
- "description": "Bad Request",
1651
- "schema": {
1652
- "type": "object"
1653
- }
1654
- },
1655
- "500": {
1656
- "description": "Internal Server Error",
1657
- "schema": {
1658
- "type": "object"
1659
- }
1660
- }
1661
- }
1662
- }
1663
- },
1664
- "get-models": {
1665
- "path": "/{repo}/-/knowledge/embedding/models",
1666
- "method": "get",
1667
- "category": "knowledge-base",
1668
- "filename": "get-models",
1669
- "summary": "获取当前支持的 Embedding 模型列表",
1670
- "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-code:r",
1671
- "permission": "repo-code:r",
1672
- "help": {
1673
- "parameter": {
1674
- "path": {
1675
- "repo": {
1676
- "type": "string",
1677
- "description": "repo",
1678
- "name": "repo",
1679
- "required": true
1680
- }
1681
- }
1682
- },
1683
- "response": {
1684
- "200": {
1685
- "description": "OK",
1686
- "schema": {
1687
- "type": "array",
1688
- "items": {
1689
- "type": "object",
1690
- "properties": {
1691
- "dimension": {
1692
- "type": "number"
1693
- },
1694
- "name": {
1695
- "type": "string"
1696
- }
1697
- }
1698
- }
1699
- }
1700
- },
1701
- "400": {
1702
- "description": "Bad Request",
1703
- "schema": {
1704
- "type": "object"
1705
- }
1706
- },
1707
- "500": {
1708
- "description": "Internal Server Error",
1709
- "schema": {
1710
- "type": "object"
1711
- }
1712
- }
1713
- }
1714
- }
1715
- }
1716
- },
1717
- "rank": {
1718
- "get-repo-annual-rank": {
1719
- "path": "/ranks/repo/annual",
1720
- "method": "get",
1721
- "category": "rank",
1722
- "filename": "get-repo-annual-rank",
1723
- "summary": "获取公仓年榜",
1724
- "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r",
1725
- "permission": "repo-basic-info:r",
1726
- "help": {
1727
- "parameter": {
1728
- "query": {
1729
- "language": {
1730
- "type": "string",
1731
- "default": "all-languages",
1732
- "description": "语言",
1733
- "name": "language",
1734
- "required": false
1735
- },
1736
- "flags": {
1737
- "type": "string",
1738
- "description": "仓库类型",
1739
- "name": "flags",
1740
- "required": false,
1741
- "enum": [
1742
- "KnowledgeBase",
1743
- "NPC",
1744
- "Skills"
1745
- ]
1746
- },
1747
- "year": {
1748
- "type": "string",
1749
- "default": "",
1750
- "description": "年榜年份,格式为2006,不填默认为本年",
1751
- "name": "year",
1752
- "required": false
1753
- },
1754
- "topN": {
1755
- "type": "number",
1756
- "default": 100,
1757
- "description": "排行前n名",
1758
- "name": "topN",
1759
- "required": false
1618
+ "default": "all-languages",
1619
+ "description": "语言",
1620
+ "name": "language",
1621
+ "required": false
1622
+ },
1623
+ "flags": {
1624
+ "type": "string",
1625
+ "description": "仓库类型",
1626
+ "name": "flags",
1627
+ "required": false,
1628
+ "enum": [
1629
+ "KnowledgeBase",
1630
+ "NPC",
1631
+ "Skills"
1632
+ ]
1633
+ },
1634
+ "date": {
1635
+ "type": "string",
1636
+ "description": "日榜日期,默认为昨天",
1637
+ "name": "date",
1638
+ "required": false
1639
+ },
1640
+ "topN": {
1641
+ "type": "number",
1642
+ "default": 100,
1643
+ "description": "排行前n名",
1644
+ "name": "topN",
1645
+ "required": false
1760
1646
  }
1761
1647
  }
1762
1648
  },
@@ -1998,12 +1884,67 @@
1998
1884
  }
1999
1885
  }
2000
1886
  },
2001
- "get-repo-daily-rank": {
2002
- "path": "/ranks/repo/daily",
1887
+ "get-language-list": {
1888
+ "path": "/ranks/repo/language-list",
2003
1889
  "method": "get",
2004
1890
  "category": "rank",
2005
- "filename": "get-repo-daily-rank",
2006
- "summary": "获取公仓日榜",
1891
+ "filename": "get-language-list",
1892
+ "summary": "获取排行榜语言",
1893
+ "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r",
1894
+ "permission": "repo-basic-info:r",
1895
+ "help": {
1896
+ "parameter": {
1897
+ "query": {
1898
+ "rankType": {
1899
+ "type": "string",
1900
+ "description": "排行榜类型",
1901
+ "name": "rankType",
1902
+ "required": true,
1903
+ "enum": [
1904
+ "daily",
1905
+ "weekly",
1906
+ "monthly",
1907
+ "annual"
1908
+ ]
1909
+ },
1910
+ "date": {
1911
+ "type": "string",
1912
+ "description": "日期",
1913
+ "name": "date",
1914
+ "required": false
1915
+ }
1916
+ }
1917
+ },
1918
+ "response": {
1919
+ "200": {
1920
+ "description": "OK",
1921
+ "schema": {
1922
+ "type": "object",
1923
+ "properties": {
1924
+ "date": {
1925
+ "type": "string"
1926
+ },
1927
+ "language": {
1928
+ "type": "array",
1929
+ "items": {
1930
+ "type": "string"
1931
+ }
1932
+ },
1933
+ "rank_type": {
1934
+ "type": "string"
1935
+ }
1936
+ }
1937
+ }
1938
+ }
1939
+ }
1940
+ }
1941
+ },
1942
+ "get-repo-monthly-rank": {
1943
+ "path": "/ranks/repo/monthly",
1944
+ "method": "get",
1945
+ "category": "rank",
1946
+ "filename": "get-repo-monthly-rank",
1947
+ "summary": "获取公仓月榜",
2007
1948
  "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r",
2008
1949
  "permission": "repo-basic-info:r",
2009
1950
  "help": {
@@ -2027,10 +1968,11 @@
2027
1968
  "Skills"
2028
1969
  ]
2029
1970
  },
2030
- "date": {
1971
+ "month": {
2031
1972
  "type": "string",
2032
- "description": "日榜日期,默认为昨天",
2033
- "name": "date",
1973
+ "default": "",
1974
+ "description": "月榜月份,格式为200601,不填默认为本月",
1975
+ "name": "month",
2034
1976
  "required": false
2035
1977
  },
2036
1978
  "topN": {
@@ -2280,73 +2222,18 @@
2280
2222
  }
2281
2223
  }
2282
2224
  },
2283
- "get-language-list": {
2284
- "path": "/ranks/repo/language-list",
2225
+ "get-repo-weekly-rank": {
2226
+ "path": "/ranks/repo/weekly",
2285
2227
  "method": "get",
2286
2228
  "category": "rank",
2287
- "filename": "get-language-list",
2288
- "summary": "获取排行榜语言",
2229
+ "filename": "get-repo-weekly-rank",
2230
+ "summary": "获取公仓周榜",
2289
2231
  "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r",
2290
2232
  "permission": "repo-basic-info:r",
2291
2233
  "help": {
2292
2234
  "parameter": {
2293
2235
  "query": {
2294
- "rankType": {
2295
- "type": "string",
2296
- "description": "排行榜类型",
2297
- "name": "rankType",
2298
- "required": true,
2299
- "enum": [
2300
- "daily",
2301
- "weekly",
2302
- "monthly",
2303
- "annual"
2304
- ]
2305
- },
2306
- "date": {
2307
- "type": "string",
2308
- "description": "日期",
2309
- "name": "date",
2310
- "required": false
2311
- }
2312
- }
2313
- },
2314
- "response": {
2315
- "200": {
2316
- "description": "OK",
2317
- "schema": {
2318
- "type": "object",
2319
- "properties": {
2320
- "date": {
2321
- "type": "string"
2322
- },
2323
- "language": {
2324
- "type": "array",
2325
- "items": {
2326
- "type": "string"
2327
- }
2328
- },
2329
- "rank_type": {
2330
- "type": "string"
2331
- }
2332
- }
2333
- }
2334
- }
2335
- }
2336
- }
2337
- },
2338
- "get-repo-monthly-rank": {
2339
- "path": "/ranks/repo/monthly",
2340
- "method": "get",
2341
- "category": "rank",
2342
- "filename": "get-repo-monthly-rank",
2343
- "summary": "获取公仓月榜",
2344
- "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r",
2345
- "permission": "repo-basic-info:r",
2346
- "help": {
2347
- "parameter": {
2348
- "query": {
2349
- "language": {
2236
+ "language": {
2350
2237
  "type": "string",
2351
2238
  "default": "all-languages",
2352
2239
  "description": "语言",
@@ -2364,11 +2251,11 @@
2364
2251
  "Skills"
2365
2252
  ]
2366
2253
  },
2367
- "month": {
2254
+ "start": {
2368
2255
  "type": "string",
2369
2256
  "default": "",
2370
- "description": "月榜月份,格式为200601,不填默认为本月",
2371
- "name": "month",
2257
+ "description": "周榜周一日期,格式为20060102,不填默认为本周",
2258
+ "name": "start",
2372
2259
  "required": false
2373
2260
  },
2374
2261
  "topN": {
@@ -2617,48 +2504,30 @@
2617
2504
  }
2618
2505
  }
2619
2506
  }
2620
- },
2621
- "get-repo-weekly-rank": {
2622
- "path": "/ranks/repo/weekly",
2507
+ }
2508
+ },
2509
+ "knowledge-base": {
2510
+ "search-npc": {
2511
+ "path": "/search/npc",
2623
2512
  "method": "get",
2624
- "category": "rank",
2625
- "filename": "get-repo-weekly-rank",
2626
- "summary": "获取公仓周榜",
2627
- "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r",
2628
- "permission": "repo-basic-info:r",
2513
+ "category": "knowledge-base",
2514
+ "filename": "search-npc",
2515
+ "summary": "全局语义搜索 NPC 角色",
2516
+ "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-basic-info:r,repo-code:r",
2517
+ "permission": "repo-basic-info:r,repo-code:r",
2629
2518
  "help": {
2630
2519
  "parameter": {
2631
2520
  "query": {
2632
- "language": {
2633
- "type": "string",
2634
- "default": "all-languages",
2635
- "description": "语言",
2636
- "name": "language",
2637
- "required": false
2638
- },
2639
- "flags": {
2640
- "type": "string",
2641
- "description": "仓库类型",
2642
- "name": "flags",
2643
- "required": false,
2644
- "enum": [
2645
- "KnowledgeBase",
2646
- "NPC",
2647
- "Skills"
2648
- ]
2649
- },
2650
- "start": {
2521
+ "key": {
2651
2522
  "type": "string",
2652
- "default": "",
2653
- "description": "周榜周一日期,格式为20060102,不填默认为本周",
2654
- "name": "start",
2655
- "required": false
2523
+ "description": "搜索关键词",
2524
+ "name": "key",
2525
+ "required": true
2656
2526
  },
2657
- "topN": {
2527
+ "top_n": {
2658
2528
  "type": "number",
2659
- "default": 100,
2660
- "description": "排行前n名",
2661
- "name": "topN",
2529
+ "description": "返回结果数量,最大20",
2530
+ "name": "top_n",
2662
2531
  "required": false
2663
2532
  }
2664
2533
  }
@@ -2671,232 +2540,363 @@
2671
2540
  "items": {
2672
2541
  "type": "object",
2673
2542
  "properties": {
2674
- "created_at": {
2675
- "type": "string"
2676
- },
2677
- "description": {
2543
+ "avatar": {
2678
2544
  "type": "string"
2679
2545
  },
2680
- "display_module": {
2681
- "type": "object",
2682
- "properties": {
2683
- "activity": {
2684
- "type": "boolean",
2685
- "description": "仓库动态"
2686
- },
2687
- "contributors": {
2688
- "type": "boolean",
2689
- "description": "仓库贡献者"
2690
- },
2691
- "release": {
2692
- "type": "boolean",
2693
- "description": "仓库版本"
2694
- }
2695
- }
2696
- },
2697
- "flags": {
2698
- "type": "string",
2699
- "enum": [
2700
- "Unknown",
2701
- "KnowledgeBase",
2702
- "NPC",
2703
- "Skills",
2704
- "Wiki"
2705
- ],
2706
- "x-enum-descriptions": [
2707
- "Unknown 未知",
2708
- "KnowledgeBase 知识库",
2709
- "NPC NPC",
2710
- "Skills 技能",
2711
- "Wiki Wiki"
2712
- ]
2713
- },
2714
- "fork_count": {
2715
- "type": "number"
2716
- },
2717
- "forked_from_repo": {
2718
- "type": "object",
2719
- "properties": {
2720
- "created_at": {
2721
- "type": "string"
2722
- },
2723
- "freeze": {
2724
- "type": "boolean"
2725
- },
2726
- "path": {
2727
- "type": "string"
2728
- },
2729
- "resource_id": {
2730
- "type": "number"
2731
- },
2732
- "resource_type": {
2733
- "type": "number",
2734
- "enum": [
2735
- 0,
2736
- 1,
2737
- 2,
2738
- 3,
2739
- 4
2740
- ],
2741
- "x-enum-descriptions": [
2742
- "SlugTypeGroup 分组",
2743
- "SlugTypeRepo 仓库",
2744
- "SlugTypeMission 任务集",
2745
- "SlugTypeRegistry 包",
2746
- "SlugTypeUnknown unknown"
2747
- ]
2748
- },
2749
- "root_freeze": {
2750
- "type": "boolean"
2751
- },
2752
- "root_id": {
2753
- "type": "number"
2754
- },
2755
- "updated_at": {
2756
- "type": "string"
2757
- }
2758
- },
2759
- "description": "预留"
2760
- },
2761
- "freeze": {
2762
- "type": "boolean"
2763
- },
2764
- "id": {
2546
+ "name": {
2765
2547
  "type": "string"
2766
2548
  },
2767
- "increase_fork": {
2768
- "type": "number"
2769
- },
2770
- "increase_star": {
2549
+ "score": {
2771
2550
  "type": "number"
2772
2551
  },
2773
- "language": {
2774
- "type": "string",
2775
- "description": "仓库程序语言,预留"
2776
- },
2777
- "languages": {
2778
- "type": "object",
2779
- "properties": {
2780
- "color": {
2781
- "type": "string"
2782
- },
2783
- "language": {
2784
- "type": "string"
2785
- }
2786
- },
2787
- "description": "仓库语言"
2788
- },
2789
- "last_update_nickname": {
2790
- "type": "string",
2791
- "description": "最新代码更新人姓名"
2792
- },
2793
- "last_update_username": {
2794
- "type": "string",
2795
- "description": "最新代码更新人账户名"
2796
- },
2797
- "last_updated_at": {
2798
- "type": "object",
2799
- "properties": {
2800
- "time": {
2801
- "type": "string"
2802
- },
2803
- "valid": {
2804
- "type": "boolean",
2805
- "description": "Valid is true if Time is not NULL"
2806
- }
2807
- },
2808
- "description": "最新代码更新时间"
2809
- },
2810
- "license": {
2552
+ "slogan": {
2811
2553
  "type": "string"
2812
2554
  },
2813
- "mark_count": {
2814
- "type": "number"
2815
- },
2816
- "name": {
2555
+ "slug": {
2817
2556
  "type": "string"
2818
- },
2819
- "npc_builded_count": {
2820
- "type": "number"
2821
- },
2822
- "npc_created_pull_count": {
2823
- "type": "number"
2824
- },
2825
- "npc_merged_pull_count": {
2826
- "type": "number"
2827
- },
2828
- "open_issue_count": {
2829
- "type": "number",
2830
- "description": "开启的issue数"
2831
- },
2832
- "open_pull_request_count": {
2833
- "type": "number",
2834
- "description": "开启的pull request数"
2835
- },
2836
- "path": {
2837
- "type": "string",
2838
- "description": "完整仓库路径"
2839
- },
2840
- "second_languages": {
2841
- "type": "object",
2842
- "properties": {
2843
- "color": {
2844
- "type": "string"
2845
- },
2846
- "language": {
2847
- "type": "string"
2557
+ }
2558
+ }
2559
+ }
2560
+ }
2561
+ },
2562
+ "400": {
2563
+ "description": "Bad Request",
2564
+ "schema": {
2565
+ "type": "object"
2566
+ }
2567
+ },
2568
+ "500": {
2569
+ "description": "Internal Server Error",
2570
+ "schema": {
2571
+ "type": "object"
2572
+ }
2573
+ }
2574
+ }
2575
+ }
2576
+ },
2577
+ "get-knowledge-base-info": {
2578
+ "path": "/{repo}/-/knowledge/base",
2579
+ "method": "get",
2580
+ "category": "knowledge-base",
2581
+ "filename": "get-knowledge-base-info",
2582
+ "summary": "获取知识库信息",
2583
+ "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-code:r",
2584
+ "permission": "repo-code:r",
2585
+ "help": {
2586
+ "parameter": {
2587
+ "path": {
2588
+ "repo": {
2589
+ "type": "string",
2590
+ "description": "repo",
2591
+ "name": "repo",
2592
+ "required": true
2593
+ }
2594
+ }
2595
+ },
2596
+ "response": {
2597
+ "200": {
2598
+ "description": "OK",
2599
+ "schema": {
2600
+ "type": "object",
2601
+ "properties": {
2602
+ "embedding_model": {
2603
+ "type": "object",
2604
+ "properties": {
2605
+ "dimension": {
2606
+ "type": "number"
2607
+ },
2608
+ "name": {
2609
+ "type": "string"
2610
+ }
2611
+ }
2612
+ },
2613
+ "exclude": {
2614
+ "type": "string"
2615
+ },
2616
+ "id": {
2617
+ "type": "string"
2618
+ },
2619
+ "include": {
2620
+ "type": "string"
2621
+ },
2622
+ "issue_last_sync_time": {
2623
+ "type": "string"
2624
+ },
2625
+ "issue_sync_enabled": {
2626
+ "type": "boolean"
2627
+ },
2628
+ "last_commit_sha": {
2629
+ "type": "string"
2630
+ },
2631
+ "metadata": {
2632
+ "type": "object",
2633
+ "properties": {
2634
+ "issue": {
2635
+ "type": "object",
2636
+ "properties": {
2637
+ "exclude_labels": {
2638
+ "type": "string",
2639
+ "description": "逗号分隔的排除标签字符串"
2640
+ },
2641
+ "labels": {
2642
+ "type": "string",
2643
+ "description": "逗号分隔的标签字符串,如 \"bug,feature\""
2644
+ },
2645
+ "state": {
2646
+ "type": "string",
2647
+ "description": "\"open\", \"closed\""
2648
+ }
2848
2649
  }
2849
2650
  },
2850
- "description": "第二语言"
2851
- },
2852
- "site": {
2853
- "type": "string"
2854
- },
2855
- "star_count": {
2856
- "type": "number"
2857
- },
2858
- "stared": {
2859
- "type": "boolean"
2860
- },
2861
- "status": {
2862
- "type": "number"
2863
- },
2864
- "tags": {
2865
- "type": "array",
2866
- "items": {
2867
- "name": {
2868
- "type": "string"
2651
+ "processing": {
2652
+ "type": "object",
2653
+ "properties": {
2654
+ "chunk_overlap": {
2655
+ "type": "number"
2656
+ },
2657
+ "chunk_size": {
2658
+ "type": "number"
2659
+ },
2660
+ "text_separator": {
2661
+ "type": "string"
2662
+ }
2663
+ }
2664
+ },
2665
+ "version": {
2666
+ "type": "string"
2667
+ }
2668
+ }
2669
+ },
2670
+ "statistics": {
2671
+ "type": "object",
2672
+ "properties": {
2673
+ "count": {
2674
+ "type": "number"
2675
+ },
2676
+ "size": {
2677
+ "type": "number"
2678
+ }
2679
+ }
2680
+ }
2681
+ }
2682
+ }
2683
+ },
2684
+ "404": {
2685
+ "description": "Not Found",
2686
+ "schema": {
2687
+ "type": "object"
2688
+ }
2689
+ },
2690
+ "500": {
2691
+ "description": "Internal Server Error",
2692
+ "schema": {
2693
+ "type": "object"
2694
+ }
2695
+ }
2696
+ }
2697
+ }
2698
+ },
2699
+ "delete-knowledge-base": {
2700
+ "path": "/{repo}/-/knowledge/base",
2701
+ "method": "delete",
2702
+ "category": "knowledge-base",
2703
+ "filename": "delete-knowledge-base",
2704
+ "summary": "删除知识库",
2705
+ "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-code:rw",
2706
+ "permission": "repo-code:rw",
2707
+ "help": {
2708
+ "parameter": {
2709
+ "path": {
2710
+ "repo": {
2711
+ "type": "string",
2712
+ "description": "repo",
2713
+ "name": "repo",
2714
+ "required": true
2715
+ }
2716
+ }
2717
+ },
2718
+ "response": {
2719
+ "200": {
2720
+ "description": "OK",
2721
+ "schema": {
2722
+ "type": "object"
2723
+ }
2724
+ },
2725
+ "404": {
2726
+ "description": "Not Found",
2727
+ "schema": {
2728
+ "type": "object"
2729
+ }
2730
+ },
2731
+ "500": {
2732
+ "description": "Internal Server Error",
2733
+ "schema": {
2734
+ "type": "object"
2735
+ }
2736
+ }
2737
+ }
2738
+ }
2739
+ },
2740
+ "query-knowledge-base": {
2741
+ "path": "/{repo}/-/knowledge/base/query",
2742
+ "method": "post",
2743
+ "category": "knowledge-base",
2744
+ "filename": "query-knowledge-base",
2745
+ "summary": "查询知识库,使用文档:https://docs.cnb.cool/zh/ai/knowledge-base.html",
2746
+ "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-code:r",
2747
+ "permission": "repo-code:r",
2748
+ "help": {
2749
+ "parameter": {
2750
+ "path": {
2751
+ "repo": {
2752
+ "type": "string",
2753
+ "description": "repo",
2754
+ "name": "repo",
2755
+ "required": true
2756
+ }
2757
+ },
2758
+ "body": {
2759
+ "description": "查询内容",
2760
+ "name": "query",
2761
+ "required": true,
2762
+ "schema": {
2763
+ "type": "object",
2764
+ "properties": {
2765
+ "metadata_filtering_conditions": {
2766
+ "type": "object",
2767
+ "properties": {
2768
+ "conditions": {
2769
+ "type": "array",
2770
+ "items": {
2771
+ "properties": {
2772
+ "comparison_operator": {
2773
+ "type": "string",
2774
+ "description": "运算符: \"is\", \"is not\", \"contains\", \"not contains\", \"starts with\", \"ends with\", \"is empty\", \"is not empty\""
2775
+ },
2776
+ "name": {
2777
+ "type": "string",
2778
+ "description": "字段名称: \"position\", \"path\", \"type\""
2779
+ },
2780
+ "value": {
2781
+ "type": "string",
2782
+ "description": "比较值(\"is empty\" 和 \"is not empty\" 时忽略此字段)"
2783
+ }
2784
+ }
2869
2785
  }
2786
+ },
2787
+ "logical_operator": {
2788
+ "type": "string",
2789
+ "description": "\"and\" 或 \"or\",默认 \"and\""
2870
2790
  }
2871
2791
  },
2872
- "topics": {
2792
+ "description": "元数据过滤条件"
2793
+ },
2794
+ "query": {
2795
+ "type": "string",
2796
+ "description": "查询语句"
2797
+ },
2798
+ "score_threshold": {
2799
+ "type": "number",
2800
+ "description": "分数阈值"
2801
+ },
2802
+ "top_k": {
2803
+ "type": "number",
2804
+ "description": "返回结果的数量"
2805
+ }
2806
+ }
2807
+ }
2808
+ }
2809
+ },
2810
+ "response": {
2811
+ "200": {
2812
+ "description": "OK",
2813
+ "schema": {
2814
+ "type": "array",
2815
+ "items": {
2816
+ "type": "object",
2817
+ "properties": {
2818
+ "chunk": {
2873
2819
  "type": "string"
2874
2820
  },
2875
- "updated_at": {
2876
- "type": "string"
2821
+ "metadata": {
2822
+ "type": "object",
2823
+ "properties": {
2824
+ "type": "object",
2825
+ "additionalProperties": {
2826
+ "type": "any"
2827
+ }
2828
+ }
2877
2829
  },
2878
- "visibility_level": {
2879
- "type": "string",
2880
- "enum": [
2881
- "Private",
2882
- "Public",
2883
- "Secret"
2884
- ],
2885
- "x-enum-descriptions": [
2886
- "VisibilityPrivate 私有仓库 - 仓库的访问必须显式授予每个用户",
2887
- "VisibilityPublic 公共仓库 - 可以不经任何身份验证克隆该项目",
2888
- "VisibilitySecret 加密仓库 - 仓库特定角色身份才能读取解密"
2889
- ]
2830
+ "score": {
2831
+ "type": "number"
2832
+ }
2833
+ }
2834
+ }
2835
+ }
2836
+ },
2837
+ "400": {
2838
+ "description": "Bad Request",
2839
+ "schema": {
2840
+ "type": "object"
2841
+ }
2842
+ },
2843
+ "500": {
2844
+ "description": "Internal Server Error",
2845
+ "schema": {
2846
+ "type": "object"
2847
+ }
2848
+ }
2849
+ }
2850
+ }
2851
+ },
2852
+ "get-models": {
2853
+ "path": "/{repo}/-/knowledge/embedding/models",
2854
+ "method": "get",
2855
+ "category": "knowledge-base",
2856
+ "filename": "get-models",
2857
+ "summary": "获取当前支持的 Embedding 模型列表",
2858
+ "description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-code:r",
2859
+ "permission": "repo-code:r",
2860
+ "help": {
2861
+ "parameter": {
2862
+ "path": {
2863
+ "repo": {
2864
+ "type": "string",
2865
+ "description": "repo",
2866
+ "name": "repo",
2867
+ "required": true
2868
+ }
2869
+ }
2870
+ },
2871
+ "response": {
2872
+ "200": {
2873
+ "description": "OK",
2874
+ "schema": {
2875
+ "type": "array",
2876
+ "items": {
2877
+ "type": "object",
2878
+ "properties": {
2879
+ "dimension": {
2880
+ "type": "number"
2890
2881
  },
2891
- "web_url": {
2882
+ "name": {
2892
2883
  "type": "string"
2893
- },
2894
- "weight_score": {
2895
- "type": "number"
2896
2884
  }
2897
2885
  }
2898
2886
  }
2899
2887
  }
2888
+ },
2889
+ "400": {
2890
+ "description": "Bad Request",
2891
+ "schema": {
2892
+ "type": "object"
2893
+ }
2894
+ },
2895
+ "500": {
2896
+ "description": "Internal Server Error",
2897
+ "schema": {
2898
+ "type": "object"
2899
+ }
2900
2900
  }
2901
2901
  }
2902
2902
  }