PageSourceSearch

https://asketch.ai/_nuxt/bzeowDb-.js

js asketch.ai collected 2026-10-05 11:53:39 UTC 30,109 bytes, 785 lines download raw bytes

1import { i as M, __tla as __tla_0 } from "./CevamKTt.js";
2import { D as O, cH as G, dE as J, dY as c, cP as W, __tla as __tla_1 } from "./D9BjAukf.js";
3import { e as Z, __tla as __tla_2 } from "./ptPK8ymH.js";
4import { h as Y, i as X, j as ee, __tla as __tla_3 } from "./D6RsBhtj.js";
5import { _ as te, __tla as __tla_4 } from "./Ck92sr5C.js";
6let Ye;
7let __tla = Promise.all([
8  (() => {
9    try {
10      return __tla_0;
11    } catch {
12    }
13  })(),
14  (() => {
15    try {
16      return __tla_1;
17    } catch {
18    }
19  })(),
20  (() => {
21    try {
22      return __tla_2;
23    } catch {
24    }
25  })(),
26  (() => {
27    try {
28      return __tla_3;
29    } catch {
30    }
31  })(),
32  (() => {
33    try {
34      return __tla_4;
35    } catch {
36    }
37  })()
38]).then(async () => {
39  let ne, t, U, j, I, D, F, We, se, z, oe, ae, le, re, ie, de, ce, ue, ge, me, he, be, pe, ke, xe, fe, ve, ye, Ce, we, Se, Me, _e, $e, Ne, Pe, Re, Ee, Be, Ie, H, Fe, Le, Qe, Te, Ve, y, Ue, K, je, He, Ae, De, ze, A, C, q, Ke;
40  ({ defineComponent: ne } = await M("vue"));
41  ({ createElementVNode: t, openBlock: U, createElementBlock: j, normalizeClass: I, createCommentVNode: D, unref: F, resolveComponent: We, createVNode: se, createStaticVNode: z } = await M("vue"));
42  oe = {
43    class: "md:w-2/3 bg-theme-background dark:bg-theme-background-700 rounded-lg p-4 shadow-md"
44  };
45  ae = {
46    class: "bg-theme-background dark:bg-theme-background-700 rounded-lg p-4 border-2 border-blue-500 dark:border-2 dark:border-blue-700 mb-4"
47  };
48  le = {
49    class: "flex items-start gap-2 mb-4"
50  };
51  re = {
52    class: "flex-1"
53  };
54  ie = {
55    class: "flex items-center gap-2"
56  };
57  de = [
58    "value"
59  ];
60  ce = {
61    class: "flex-1"
62  };
63  ue = {
64    class: "flex items-center gap-2"
65  };
66  ge = [
67    "value"
68  ];
69  me = {
70    class: "flex-1"
71  };
72  he = {
73    class: "flex items-center gap-2"
74  };
75  be = [
76    "value"
77  ];
78  pe = {
79    class: "mb-4"
80  };
81  ke = {
82    class: "space-y-2"
83  };
84  xe = {
85    class: "flex items-center gap-2"
86  };
87  fe = [
88    "checked"
89  ];
90  ve = {
91    class: "flex items-center gap-2"
92  };
93  ye = [
94    "checked"
95  ];
96  Ce = {
97    class: "flex items-center gap-2"
98  };
99  we = [
100    "checked"
101  ];
102  Se = [
103    "value"
104  ];
105  Me = {
106    class: "mb-6"
107  };
108  _e = {
109    class: "flex gap-3 mb-4"
110  };
111  $e = [
112    "checked"
113  ];
114  Ne = {
115    class: "flex items-start gap-3"
116  };
117  Pe = [
118    "checked"
119  ];
120  Re = {
121    class: "flex items-start gap-3"
122  };
123  Ee = {
124    key: 0,
125    class: "flex items-center gap-2 px-4 py-3 mb-4 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg"
126  };
127  Be = {
128    key: 1,
129    class: "mb-4"
130  };
131  Ie = {
132    class: "flex justify-end gap-3"
133  };
134  ({ ref: H, computed: Fe, onMounted: Le } = await M("vue"));
135  Qe = ne({
136    __name: "SegmentSettings",
137    props: {
138      chunkSettings: {},
139      textProcessingRules: {},
140      indexMethod: {},
141      useHierarchicalChunking: {
142        type: Boolean
143      },
144      fileName: {},
145      fileContent: {},
146      uploadedFiles: {},
147      embeddingModel: {},
148      embeddingModelProvider: {},
149      providerId: {},
150      datasetId: {},
151      knowledgeName: {}
152    },
153    emits: [
154      "chunkSettingsChange",
155      "textProcessingRulesChange",
156      "indexMethodChange",
157      "applyChunkSettings",
158      "hierarchicalChunkingChange",
159      "embeddingModelChange"
160    ],
161    setup(u, { emit: $ }) {
162      const N = O(), _ = G(), L = Z(), x = (n) => {
163        const e = n.content || "";
164        if (e.startsWith("data:")) {
165          const s = e.match(/^data:([^;]+);base64,(.+)$/);
166          if (s && s[2]) {
167            const g = s[1] || n.type, a = s[2], d = atob(a), m = new Uint8Array(d.length);
168            for (let l = 0; l < d.length; l++) m[l] = d.charCodeAt(l);
169            const h = new Blob([
170              m
171            ], {
172              type: g
173            });
174            return new File([
175              h
176            ], n.name, {
177              type: g
178            });
179          }
180        }
181        const o = new Blob([
182          e
183        ], {
184          type: n.type
185        });
186        return new File([
187          o
188        ], n.name, {
189          type: n.type
190        });
191      }, r = u, i = $, p = H([]), w = H(false), k = H(""), Q = Fe(() => p.value.map((n) => {
192        var _a, _b;
193        return {
194          label: ((_a = n.label) == null ? void 0 : _a.zh_Hans) || ((_b = n.label) == null ? void 0 : _b.en_US) || n.provider,
195          options: (n.models || []).map((e) => {
196            var _a2, _b2;
197            return {
198              label: ((_a2 = e.label) == null ? void 0 : _a2.zh_Hans) || ((_b2 = e.label) == null ? void 0 : _b2.en_US) || e.model,
199              value: `${n.provider}::${e.model}`
200            };
201          })
202        };
203      })), f = async () => {
204        var _a;
205        if (!(p.value.length > 0)) {
206          w.value = true;
207          try {
208            const n = await Y(r.providerId);
209            if (p.value = n || [], !k.value && p.value.length > 0) {
210              const e = p.value[0], o = (_a = e == null ? void 0 : e.models) == null ? void 0 : _a[0];
211              o && e && (k.value = `${e.provider}::${o.model}`, i("embeddingModelChange", o.model || "", e.provider || ""));
212            }
213          } catch (n) {
214            console.error("\u52A0\u8F7D Embedding \u6A21\u578B\u5931\u8D25:", n), c.error("\u52A0\u8F7D Embedding \u6A21\u578B\u5217\u8868\u5931\u8D25");
215          } finally {
216            w.value = false;
217          }
218        }
219      }, P = (n) => {
220        if (typeof n != "string" || !n) return;
221        k.value = n;
222        const [e, o] = n.split("::");
223        i("embeddingModelChange", o || "", e || "");
224      }, R = (n) => {
225        i("indexMethodChange", n), n === "highQuality" && f();
226      };
227      Le(() => {
228        r.indexMethod === "highQuality" && f();
229      });
230      const S = (n, e) => {
231        const o = {
232          ...r.chunkSettings,
233          [n]: e
234        };
235        i("chunkSettingsChange", o), i("applyChunkSettings");
236      }, v = (n, e) => {
237        const o = {
238          ...r.textProcessingRules,
239          [n]: e
240        };
241        i("textProcessingRulesChange", o), i("applyChunkSettings");
242      }, E = () => {
243        const n = {
244          chunkMark: `
245
246`,
247          maxChunkLength: 1024,
248          minChunkLength: 50
249        }, e = {
250          replaceConsecutiveSpaces: true,
251          removeUrls: false,
252          useQaFormat: false,
253          language: "Chinese Simplified"
254        };
255        i("chunkSettingsChange", n), i("textProcessingRulesChange", e), i("applyChunkSettings"), c.success("\u901A\u7528\u8BBE\u7F6E\u5DF2\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u503C");
256      }, T = async () => {
257        try {
258          const n = {
259            chunkSettings: r.chunkSettings,
260            textProcessingRules: r.textProcessingRules,
261            indexMethod: r.indexMethod,
262            useHierarchicalChunking: r.useHierarchicalChunking
263          };
264          console.log("\u4FDD\u5B58\u5E76\u5904\u7406\u8BBE\u7F6E:", n);
265          const e = [];
266          if (r.uploadedFiles && r.uploadedFiles.length > 0 && e.push(...r.uploadedFiles.map(x)), e.length === 0) {
267            c.error("\u6CA1\u6709\u53EF\u5904\u7406\u7684\u6587\u4EF6");
268            return;
269          }
270          const o = r.datasetId || _.query.knowledge_id, s = r.knowledgeName || _.query.name;
271          o ? await B({
272            knowledgeId: o,
273            knowledgeName: s,
274            files: e,
275            settings: n
276          }) : await V({
277            files: e,
278            settings: n
279          });
280        } catch (n) {
281          c.destroy(), c.error("\u521B\u5EFA\u77E5\u8BC6\u5E93\u6216\u4E0A\u4F20\u6587\u4EF6\u65F6\u53D1\u751F\u9519\u8BEF: " + (n instanceof Error ? n.message : String(n))), console.error("\u64CD\u4F5C\u5931\u8D25:", n);
282        }
283      }, B = async ({ knowledgeId: n, knowledgeName: e, files: o, settings: s }) => {
284        const g = o.length, a = [], d = [];
285        c.loading(`\u6B63\u5728\u4E0A\u4F20 ${g} \u4E2A\u6587\u4EF6\u5230\u77E5\u8BC6\u5E93...`, 0);
286        try {
287          for (let h = 0; h < o.length; h++) {
288            const l = o[h];
289            if (l) try {
290              c.loading(`\u6B63\u5728\u4E0A\u4F20\u6587\u4EF6 ${h + 1}/${g}: ${l.name}...`, 0);
291              const b = await X(n, l, s);
292              b && b.document && b.document.id ? a.push({
293                success: true,
294                fileName: l.name,
295                batchId: b.batch
296              }) : (d.push(l.name), a.push({
297                success: false,
298                fileName: l.name
299              }));
300            } catch (b) {
301              console.error(`\u4E0A\u4F20\u6587\u4EF6 ${l.name} \u5931\u8D25:`, b), d.push(l.name), a.push({
302                success: false,
303                fileName: l.name
304              });
305            }
306          }
307          c.destroy();
308          const m = a.filter((h) => h.success).length;
309          if (m > 0) {
310            const h = a.filter((l) => l.success && l.batchId).map((l) => ({
311              fileName: l.fileName,
312              batchId: l.batchId
313            }));
314            d.length > 0 ? c.warning(`${m} \u4E2A\u6587\u4EF6\u4E0A\u4F20\u6210\u529F\uFF0C${d.length} \u4E2A\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25: ${d.join(", ")}`) : c.success(`\u6210\u529F\u4E0A\u4F20 ${m} \u4E2A\u6587\u4EF6!`), L.setCreatedNavData({
315              knowledgeName: e,
316              files: h
317            }), N.push(`/admin/knowledge/${n}/created`);
318          } else c.error("\u6240\u6709\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
319        } catch (m) {
320          throw c.destroy(), m;
321        }
322      }, V = async ({ files: n, settings: e }) => {
323        var _a;
324        if (!r.providerId) {
325          c.error("\u8BF7\u5148\u9009\u62E9\u6570\u636E\u6E90 Provider");
326          return;
327        }
328        const o = ((_a = n[0]) == null ? void 0 : _a.name) || r.fileName, s = r.indexMethod === "economy" ? "economy" : "high_quality", g = {
329          name: `${o.replace(/.[^/.]+$/, "")}_${Date.now()}`,
330          description: n.length > 1 ? `\u77E5\u8BC6\u5E93 - \u5305\u542B ${n.length} \u4E2A\u6587\u4EF6` : `\u77E5\u8BC6\u5E93 - ${o}`,
331          indexing_technique: s,
332          permission: "only_me",
333          provider: "vendor",
334          provider_id: r.providerId
335        };
336        if (r.indexMethod === "highQuality" && k.value) {
337          const [d, m] = k.value.split("::");
338          m && d && (g.embedding_model = m, g.embedding_model_provider = d);
339        }
340        c.loading("\u6B63\u5728\u521B\u5EFA\u77E5\u8BC6\u5E93...", 0);
341        const a = await ee(g);
342        c.destroy(), a && a.id ? (c.success("\u77E5\u8BC6\u5E93\u521B\u5EFA\u6210\u529F!"), await B({
343          knowledgeId: a.id,
344          knowledgeName: a.name,
345          files: n,
346          settings: e
347        })) : c.error("\u77E5\u8BC6\u5E93\u521B\u5EFA\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
348      };
349      return (n, e) => {
350        const o = J;
351        return U(), j("div", oe, [
352          e[28] || (e[28] = t("h3", {
353            class: "text-lg font-medium mb-4"
354          }, " \u5206\u6BB5\u8BBE\u7F6E ", -1)),
355          t("div", ae, [
356            e[20] || (e[20] = t("div", {
357              class: "mb-4"
358            }, [
359              t("h4", null, "\u901A\u7528"),
360              t("label", {
361                class: "block text-sm font-medium text-gray-700 dark:text-gray-400 mb-2"
362              }, " \u901A\u7528\u6587\u672C\u5206\u5757\u6A21\u5F0F\uFF0C\u68C0\u7D22\u548C\u53EC\u56DE\u7684\u5757\u662F\u76F8\u540C\u7684 ")
363            ], -1)),
364            t("div", le, [
365              t("div", re, [
366                e[10] || (e[10] = t("label", {
367                  class: "block text-sm font-medium mb-2"
368                }, " \u5206\u6BB5\u6807\u8BC6\u7B26 ", -1)),
369                t("div", ie, [
370                  t("input", {
371                    type: "text",
372                    value: u.chunkSettings.chunkMark,
373                    placeholder: "\u9ED8\u8BA4\u4E3A\uFF1A\\n\\n",
374                    class: "w-1/2 rounded-md border border-gray-300 dark:border-gray-600 bg-theme-background dark:bg-theme-background-400 px-3 py-2 text-sm",
375                    onChange: e[0] || (e[0] = (s) => S("chunkMark", s.target.value || `
376
377`))
378                  }, null, 40, de)
379                ])
380              ]),
381              t("div", ce, [
382                e[12] || (e[12] = t("label", {
383                  class: "block text-sm font-medium mb-2"
384                }, " \u5206\u6BB5\u6700\u5927\u957F\u5EA6 ", -1)),
385                t("div", ue, [
386                  t("input", {
387                    type: "number",
388                    value: u.chunkSettings.maxChunkLength,
389                    min: "50",
390                    max: "2048",
391                    class: "w-1/2 rounded-md border border-gray-300 dark:border-gray-600 bg-theme-background dark:bg-theme-background-400 px-3 py-2 text-sm",
392                    onChange: e[1] || (e[1] = (s) => S("maxChunkLength", Number(s.target.value)))
393                  }, null, 40, ge),
394                  e[11] || (e[11] = t("span", {
395                    class: "text-sm"
396                  }, "characters", -1))
397                ])
398              ]),
399              t("div", me, [
400                e[14] || (e[14] = t("label", {
401                  class: "block text-sm font-medium mb-2"
402                }, " \u5206\u6BB5\u91CD\u53E0\u957F\u5EA6 ", -1)),
403                t("div", he, [
404                  t("input", {
405                    type: "number",
406                    value: u.chunkSettings.minChunkLength,
407                    min: "10",
408                    max: "500",
409                    class: "w-1/2 rounded-md border border-gray-300 bg-theme-background dark:bg-theme-background-400 px-3 py-2 text-sm",
410                    onChange: e[2] || (e[2] = (s) => S("minChunkLength", Number(s.target.value)))
411                  }, null, 40, be),
412                  e[13] || (e[13] = t("span", {
413                    class: "text-sm"
414                  }, "characters", -1))
415                ])
416              ])
417            ]),
418            t("div", pe, [
419              e[19] || (e[19] = t("h4", {
420                class: "text-md font-medium mb-2"
421              }, " \u6587\u672C\u5904\u7406\u89C4\u5219 ", -1)),
422              t("div", ke, [
423                t("label", xe, [
424                  t("input", {
425                    type: "checkbox",
426                    checked: u.textProcessingRules.replaceConsecutiveSpaces,
427                    class: "rounded tex focus:ring-blue-500",
428                    onChange: e[3] || (e[3] = (s) => v("replaceConsecutiveSpaces", s.target.checked))
429                  }, null, 40, fe),
430                  e[15] || (e[15] = t("span", {
431                    class: "text-sm"
432                  }, " \u66FF\u6362\u8FDE\u7EED\u7684\u7A7A\u683C\u3001\u6362\u884C\u7B26\u548C\u5236\u8868\u7B26 ", -1))
433                ]),
434                t("label", ve, [
435                  t("input", {
436                    type: "checkbox",
437                    checked: u.textProcessingRules.removeUrls,
438                    class: "rounded text-theme-primary focus:ring-blue-500",
439                    onChange: e[4] || (e[4] = (s) => v("removeUrls", s.target.checked))
440                  }, null, 40, ye),
441                  e[16] || (e[16] = t("span", {
442                    class: "text-sm"
443                  }, " \u5220\u9664\u6240\u6709 URL \u548C\u7535\u5B50\u90AE\u4EF6\u5730\u5740 ", -1))
444                ]),
445                t("label", Ce, [
446                  t("input", {
447                    type: "checkbox",
448                    checked: u.textProcessingRules.useQaFormat,
449                    class: "rounded focus:ring-blue-500",
450                    onChange: e[5] || (e[5] = (s) => v("useQaFormat", s.target.checked))
451                  }, null, 40, we),
452                  e[18] || (e[18] = t("span", {
453                    class: "text-sm"
454                  }, " \u4F7F\u7528 Q&A \u5206\u6BB5\uFF0C\u8BED\u8A00 ", -1)),
455                  t("select", {
456                    value: u.textProcessingRules.language,
457                    class: "w-48 rounded-md border border-gray-300 dark:border-gray-600 bg-theme-background dark:bg-theme-background-400 px-2 py-1 text-sm",
458                    onChange: e[6] || (e[6] = (s) => v("language", s.target.value))
459                  }, [
460                    ...e[17] || (e[17] = [
461                      t("option", {
462                        value: "Chinese Simplified"
463                      }, "\u7B80\u4F53\u4E2D\u6587", -1),
464                      t("option", {
465                        value: "English"
466                      }, "English", -1),
467                      t("option", {
468                        value: "Japanese"
469                      }, "\u65E5\u672C\u8A9E", -1),
470                      t("option", {
471                        value: "Korean"
472                      }, "\uD55C\uAD6D\uC5B4", -1)
473                    ])
474                  ], 40, Se)
475                ])
476              ])
477            ]),
478            t("div", null, [
479              t("button", {
480                class: "text-sm text-theme-primary hover:text-theme-primary-700",
481                onClick: E
482              }, " \u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u8BBE\u7F6E ")
483            ])
484          ]),
485          t("div", Me, [
486            e[27] || (e[27] = t("h4", {
487              class: "text-md font-medium mb-3"
488            }, " \u7D22\u5F15\u65B9\u5F0F ", -1)),
489            t("div", _e, [
490              t("label", {
491                class: I([
492                  "index-method-card flex-1 p-4 border-2 rounded-lg cursor-pointer transition-all duration-200",
493                  u.indexMethod === "highQuality" ? "border-blue-500 bg-blue-50 dark:bg-blue-900/20 shadow-sm" : "border-gray-200 dark:border-gray-600 hover:border-blue-300 dark:hover:border-blue-700 hover:bg-gray-50 dark:hover:bg-gray-800"
494                ])
495              }, [
496                t("input", {
497                  type: "radio",
498                  name: "indexMethod",
499                  checked: u.indexMethod === "highQuality",
500                  class: "sr-only",
501                  onChange: e[7] || (e[7] = (s) => R("highQuality"))
502                }, null, 40, $e),
503                t("div", Ne, [
504                  t("div", {
505                    class: I([
506                      "flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center",
507                      u.indexMethod === "highQuality" ? "bg-blue-500 text-white" : "bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"
508                    ])
509                  }, [
510                    ...e[21] || (e[21] = [
511                      t("svg", {
512                        xmlns: "http://www.w3.org/2000/svg",
513                        class: "w-5 h-5",
514                        viewBox: "0 0 24 24",
515                        fill: "none",
516                        stroke: "currentColor",
517                        "stroke-width": "2",
518                        "stroke-linecap": "round",
519                        "stroke-linejoin": "round"
520                      }, [
521                        t("polygon", {
522                          points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
523                        })
524                      ], -1)
525                    ])
526                  ], 2),
527                  e[22] || (e[22] = z('<div class="flex-1 min-w-0"><div class="flex items-center gap-2 mb-1"><span class="font-semibold text-gray-900 dark:text-gray-100">\u9AD8\u8D28\u91CF</span><span class="px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-700 dark:bg-blue-800 dark:text-blue-200 rounded-full">\u63A8\u8350</span></div><p class="text-sm text-gray-500 dark:text-gray-400 leading-relaxed"> \u8C03\u7528\u5D4C\u5165\u6A21\u578B\u5904\u7406\u6587\u6863\u4EE5\u5B9E\u73B0\u66F4\u7CBE\u786E\u7684\u68C0\u7D22\uFF0C\u53EF\u4EE5\u5E2E\u52A9 LLM \u751F\u6210\u9AD8\u8D28\u91CF\u7684\u7B54\u6848\u3002 </p></div>', 1))
528                ])
529              ], 2),
530              t("label", {
531                class: I([
532                  "index-method-card flex-1 p-4 border-2 rounded-lg cursor-pointer transition-all duration-200",
533                  u.indexMethod === "economy" ? "border-blue-500 bg-blue-50 dark:bg-blue-900/20 shadow-sm" : "border-gray-200 dark:border-gray-600 hover:border-blue-300 dark:hover:border-blue-700 hover:bg-gray-50 dark:hover:bg-gray-800"
534                ])
535              }, [
536                t("input", {
537                  type: "radio",
538                  name: "indexMethod",
539                  checked: u.indexMethod === "economy",
540                  class: "sr-only",
541                  onChange: e[8] || (e[8] = (s) => R("economy"))
542                }, null, 40, Pe),
543                t("div", Re, [
544                  t("div", {
545                    class: I([
546                      "flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center",
547                      u.indexMethod === "economy" ? "bg-blue-500 text-white" : "bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400"
548                    ])
549                  }, [
550                    ...e[23] || (e[23] = [
551                      t("svg", {
552                        xmlns: "http://www.w3.org/2000/svg",
553                        class: "w-5 h-5",
554                        viewBox: "0 0 24 24",
555                        fill: "none",
556                        stroke: "currentColor",
557                        "stroke-width": "2",
558                        "stroke-linecap": "round",
559                        "stroke-linejoin": "round"
560                      }, [
561                        t("circle", {
562                          cx: "12",
563                          cy: "12",
564                          r: "10"
565                        }),
566                        t("path", {
567                          d: "M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"
568                        }),
569                        t("path", {
570                          d: "M12 18V6"
571                        })
572                      ], -1)
573                    ])
574                  ], 2),
575                  e[24] || (e[24] = t("div", {
576                    class: "flex-1 min-w-0"
577                  }, [
578                    t("div", {
579                      class: "flex items-center gap-2 mb-1"
580                    }, [
581                      t("span", {
582                        class: "font-semibold text-gray-900 dark:text-gray-100"
583                      }, "\u7ECF\u6D4E")
584                    ]),
585                    t("p", {
586                      class: "text-sm text-gray-500 dark:text-gray-400 leading-relaxed"
587                    }, " \u6BCF\u4E2A\u6570\u636E\u5757\u4F7F\u7528 10 \u4E2A\u5173\u952E\u8BCD\u8FDB\u884C\u68C0\u7D22\uFF0C\u4E0D\u4F1A\u6D88\u8017\u4EFB\u4F55 tokens\uFF0C\u4F46\u4F1A\u4EE5\u964D\u4F4E\u68C0\u7D22\u51C6\u786E\u6027\u4E3A\u4EE3\u4EF7\u3002 ")
588                  ], -1))
589                ])
590              ], 2)
591            ]),
592            u.indexMethod === "highQuality" ? (U(), j("div", Ee, [
593              ...e[25] || (e[25] = [
594                z('<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-amber-500 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"></path><path d="M12 9v4"></path><path d="M12 17h.01"></path></svg><span class="text-sm text-theme-warning"> \u4F7F\u7528\u9AD8\u8D28\u91CF\u6A21\u5F0F\u8FDB\u884C\u5D4C\u5165\u540E\uFF0C\u65E0\u6CD5\u5207\u6362\u56DE\u7ECF\u6D4E\u6A21\u5F0F\u3002 </span>', 2)
595              ])
596            ])) : D("", true),
597            u.indexMethod === "highQuality" ? (U(), j("div", Be, [
598              e[26] || (e[26] = t("h4", {
599                class: "text-md font-medium mb-2"
600              }, " Embedding \u6A21\u578B ", -1)),
601              se(o, {
602                value: F(k),
603                loading: F(w),
604                options: F(Q),
605                placeholder: "\u9009\u62E9 Embedding \u6A21\u578B",
606                class: "w-full",
607                size: "large",
608                "show-search": "",
609                "filter-option": (s, g) => {
610                  var _a;
611                  return (_a = g.label) == null ? void 0 : _a.toLowerCase().includes(s.toLowerCase());
612                },
613                onChange: P
614              }, null, 8, [
615                "value",
616                "loading",
617                "options",
618                "filter-option"
619              ])
620            ])) : D("", true)
621          ]),
622          t("div", Ie, [
623            t("button", {
624              class: "px-4 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",
625              onClick: e[9] || (e[9] = () => F(N).back())
626            }, " \u53D6\u6D88 "),
627            t("button", {
628              class: "px-6 py-2 text-sm bg-theme-primary hover:bg-theme-primary-700 text-white rounded-md transition-colors",
629              onClick: T
630            }, " \u4FDD\u5B58\u5E76\u5904\u7406 ")
631          ])
632        ]);
633      };
634    }
635  });
636  Te = Object.assign(Qe, {
637    __name: "KnowledgeSegmentSettings"
638  });
639  ({ defineComponent: Ve } = await M("vue"));
640  ({ unref: y, createVNode: Ue, createElementVNode: K, openBlock: je, createElementBlock: He } = await M("vue"));
641  Ae = {
642    class: "w-full h-full flex justify-start items-start ml-5 overflow-auto"
643  };
644  De = {
645    class: "w-full max-w-6xl"
646  };
647  ze = {
648    class: "flex flex-col md:flex-row gap-6"
649  };
650  ({ computed: A, ref: C, watch: q } = await M("vue"));
651  Ke = Ve({
652    __name: "TextSegmentation",
653    props: {
654      datasetId: {},
655      knowledgeName: {}
656    },
657    setup(u) {
658      const $ = u, N = Z(), { createFlow: _ } = W(N), L = A(() => _.value.providerId || ""), x = A(() => _.value.uploadedFilesData), r = C(0), i = C({
659        chunkMark: `
660
661`,
662        maxChunkLength: 1024,
663        minChunkLength: 50
664      }), p = C({
665        replaceConsecutiveSpaces: true,
666        removeUrls: false,
667        useQaFormat: false,
668        language: "Chinese Simplified"
669      }), w = C("highQuality"), k = C(false), Q = C([]), f = C(""), P = C(false), R = A(() => {
670        var _a;
671        return x.value.length > 0 && r.value >= 0 ? ((_a = x.value[r.value]) == null ? void 0 : _a.name) ?? "" : "";
672      });
673      q(x, (e) => {
674        e && e.length > 0 && e[0] && S(e[0]);
675      }, {
676        immediate: true
677      }), q(r, (e) => {
678        x.value.length > e && S(x.value[e]);
679      });
680      const S = async (e) => {
681        P.value = true;
682        try {
683          await new Promise((o) => setTimeout(o, 300)), e.content ? (f.value = e.content, console.log(`\u4F7F\u7528\u5B9E\u9645\u6587\u4EF6\u5185\u5BB9: ${e.name}`)) : console.log(`\u4F7F\u7528\u6A21\u62DF\u6587\u4EF6\u5185\u5BB9: ${e.name}`), E(f.value);
684        } catch {
685          c.error("\u52A0\u8F7D\u6587\u4EF6\u5185\u5BB9\u5931\u8D25");
686        } finally {
687          P.value = false;
688        }
689      }, v = () => {
690        f.value && (E(f.value), c.success("\u5206\u6BB5\u8BBE\u7F6E\u5DF2\u66F4\u65B0"));
691      }, E = (e) => {
692        let o = e;
693        if (p.value.replaceConsecutiveSpaces && (o = o.replace(/\s+/g, " ")), p.value.removeUrls) {
694          const a = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g;
695          o = o.replace(a, "[URL removed]");
696        }
697        let s = [];
698        i.value.chunkMark === `
699` ? s = o.split(`
700`) : i.value.chunkMark === "\u3002" ? (s = o.split("\u3002").filter((a) => a.trim() !== ""), s = s.map((a) => a + "\u3002")) : i.value.chunkMark === "." ? (s = o.split(".").filter((a) => a.trim() !== ""), s = s.map((a) => a + ".")) : i.value.chunkMark === `
701
702` && (s = o.split(`
703
704`)), s = s.filter((a) => a.trim().length >= i.value.minChunkLength);
705        const g = [];
706        s.forEach((a) => {
707          if (a.length <= i.value.maxChunkLength) g.push(a);
708          else {
709            let d = 0;
710            for (; d < a.length; ) {
711              const m = Math.min(d + i.value.maxChunkLength, a.length);
712              let h = m;
713              for (let l = m; l > d && l > m - 50; l--) {
714                const b = a[l];
715                if (b === " " || b === `
716` || b === "\u3002" || b === ".") {
717                  h = l + 1;
718                  break;
719                }
720              }
721              g.push(a.substring(d, h)), d = h;
722            }
723          }
724        }), Q.value = g.map((a, d) => ({
725          id: `chunk-${d + 1}`,
726          content: a.trim(),
727          length: a.trim().length
728        }));
729      }, T = (e) => {
730        w.value = e;
731      }, B = (e) => {
732        i.value = e, v();
733      }, V = (e) => {
734        p.value = e, v();
735      }, n = (e) => {
736        k.value = e, v();
737      };
738      return (e, o) => (je(), He("div", Ae, [
739        K("div", De, [
740          K("div", ze, [
741            Ue(Te, {
742              "chunk-settings": y(i),
743              "text-processing-rules": y(p),
744              "index-method": y(w),
745              "use-hierarchical-chunking": y(k),
746              "file-name": y(R),
747              "file-content": y(f),
748              "uploaded-files": y(x),
749              "provider-id": y(L),
750              "dataset-id": $.datasetId,
751              "knowledge-name": $.knowledgeName,
752              onChunkSettingsChange: B,
753              onTextProcessingRulesChange: V,
754              onIndexMethodChange: T,
755              onHierarchicalChunkingChange: n
756            }, null, 8, [
757              "chunk-settings",
758              "text-processing-rules",
759              "index-method",
760              "use-hierarchical-chunking",
761              "file-name",
762              "file-content",
763              "uploaded-files",
764              "provider-id",
765              "dataset-id",
766              "knowledge-name"
767            ])
768          ])
769        ])
770      ]));
771    }
772  });
773  Ye = Object.assign(te(Ke, [
774    [
775      "__scopeId",
776      "data-v-22c650ed"
777    ]
778  ]), {
779    __name: "KnowledgeTextSegmentation"
780  });
781});
782export {
783  Ye as _,
784  __tla
785};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.