@baishuyun/coze-provider 0.1.0 → 1.0.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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @baishuyun/coze-provider@0.0.17 build /Users/bbbottle/Code/bs-chat-sdk/packages/coze-provider
3
+ > @baishuyun/coze-provider@0.1.1 build /Users/bbbottle/Code/bs-chat-sdk/packages/coze-provider
4
4
  > tsup --tsconfig tsconfig.json --clean
5
5
 
6
6
  CLI Building entry: src/index.ts
@@ -11,13 +11,13 @@
11
11
  CLI Cleaning output folder
12
12
  CJS Build start
13
13
  ESM Build start
14
- CJS dist/index.js 50.91 KB
15
- CJS dist/index.js.map 94.87 KB
16
- CJS ⚡️ Build success in 30ms
17
- ESM dist/index.mjs 48.87 KB
18
- ESM dist/index.mjs.map 94.55 KB
19
- ESM ⚡️ Build success in 31ms
14
+ ESM dist/index.mjs 49.49 KB
15
+ ESM dist/index.mjs.map 95.37 KB
16
+ ESM ⚡️ Build success in 40ms
17
+ CJS dist/index.js 51.55 KB
18
+ CJS dist/index.js.map 95.69 KB
19
+ CJS ⚡️ Build success in 40ms
20
20
  DTS Build start
21
- DTS ⚡️ Build success in 860ms
21
+ DTS ⚡️ Build success in 844ms
22
22
  DTS dist/index.d.ts 1.57 KB
23
23
  DTS dist/index.d.mts 1.57 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @baishuyun/coze-provider
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - refactor sdk
8
+
9
+ ## 0.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - update field design style
14
+
3
15
  ## 0.1.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.js CHANGED
@@ -54,30 +54,42 @@ var import_api = require("@coze/api");
54
54
  // src/utils/excel2json.ts
55
55
  var import_xlsx = __toESM(require("xlsx"));
56
56
  var excel2json = (file) => {
57
- const workbook = import_xlsx.default.read(file, {
58
- type: "array",
59
- // 'buffer'
60
- cellStyles: true,
61
- cellFormula: true,
62
- cellDates: true,
63
- cellNF: true,
64
- sheetStubs: true,
65
- bookVBA: true
66
- });
57
+ let workbook;
58
+ try {
59
+ workbook = import_xlsx.default.read(file, {
60
+ type: "array",
61
+ // 或 'buffer'
62
+ cellFormula: false
63
+ });
64
+ } catch (e) {
65
+ return JSON.stringify(null);
66
+ }
67
67
  const result = {
68
68
  sheets: []
69
69
  };
70
70
  workbook.SheetNames.forEach((sheetName) => {
71
71
  const worksheet = workbook.Sheets[sheetName];
72
+ if (!worksheet) {
73
+ return;
74
+ }
75
+ const maxRows = 1e3;
76
+ const ref = worksheet["!ref"] || "A1";
77
+ const range = import_xlsx.default.utils.decode_range(ref);
78
+ const limitedRange = {
79
+ ...range,
80
+ e: { ...range.e, r: Math.min(range.e.r, range.s.r + maxRows - 1) }
81
+ };
72
82
  const data = import_xlsx.default.utils.sheet_to_json(worksheet, {
73
83
  header: 1,
74
84
  // 使用数组格式
75
- defval: null,
76
- // 空单元格默认值
77
85
  raw: false,
78
86
  // 格式化值
79
- dateNF: "yyyy-mm-dd"
87
+ dateNF: "yyyy-mm-dd",
80
88
  // 日期格式
89
+ range: limitedRange,
90
+ // 使用限制后的范围
91
+ defval: null
92
+ // 空单元格默认值
81
93
  });
82
94
  result.sheets.push({
83
95
  name: sheetName,
@@ -536,6 +548,7 @@ var CozeLanguageModel = class {
536
548
  console.warn("x-user-var parse error", e);
537
549
  }
538
550
  }
551
+ console.log("msssage send to coze", JSON.stringify(messages, null, 2));
539
552
  const body = {
540
553
  bot_id: this.config.botId,
541
554
  auto_save_history: false,
@@ -1019,6 +1032,19 @@ var rebuildSn = (truncatedJson) => {
1019
1032
  importMode: 1,
1020
1033
  //导入模式 1 excel末尾递增 2 excel最大值递增 3 excel/表单最大值比较递增
1021
1034
  ...widget,
1035
+ rules: [
1036
+ {
1037
+ chars: "sn-",
1038
+ type: "fixedChars"
1039
+ },
1040
+ {
1041
+ digitsNum: 5,
1042
+ fixedLength: true,
1043
+ resetDuration: "none",
1044
+ startValue: 1,
1045
+ type: "incNumber"
1046
+ }
1047
+ ],
1022
1048
  labelStyle: label
1023
1049
  },
1024
1050
  // description,