@glodon-aiot/chat-app-sdk 0.0.1-alpha.15 → 0.0.1-alpha.17

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.
package/es/index.esm.js CHANGED
@@ -120734,14 +120734,14 @@ const eventMeta = {
120734
120734
  is_release: false,
120735
120735
  dev: false
120736
120736
  };
120737
- var chat_ApiUrl = /*#__PURE__*/ function(ApiUrl) {
120737
+ /* eslint-disable @typescript-eslint/naming-convention -- 枚举值使用小写以匹配 Env 类型字符串值 */ var chat_ApiUrl = /*#__PURE__*/ function(ApiUrl) {
120738
120738
  ApiUrl["dev"] = "https://aiot-dev.glodon.com/api/cvforcepd/flow";
120739
120739
  ApiUrl["test"] = "https://aiot-dev.glodon.com/api/cvforce/flow";
120740
120740
  ApiUrl["prod"] = "https://copilot.glodon.com/api/cvforce/flow";
120741
120741
  ApiUrl["local"] = "http://localhost:8082/api/cvforcepd/flow";
120742
120742
  return ApiUrl;
120743
120743
  }({});
120744
- // 修改:根据优先级获取最终的 API 地址
120744
+ /* eslint-enable @typescript-eslint/naming-convention */ // 修改:根据优先级获取最终的 API 地址
120745
120745
  /**
120746
120746
  * 获取最终使用的 API 地址
120747
120747
  * @param customApiUrl - 用户自定义的 API 地址(最高优先级)
@@ -296062,7 +296062,7 @@ const TextContent = (props)=>{
296062
296062
  showIndicator: isStreaming,
296063
296063
  smooth: isStreaming,
296064
296064
  imageOptions: {
296065
- forceHttps: !undefined,
296065
+ forceHttps: !true,
296066
296066
  ...imageOptions
296067
296067
  },
296068
296068
  eventCallbacks: {
@@ -380012,7 +380012,9 @@ const TOAST_ERROR_WHITE_LIST = [
380012
380012
  700015002
380013
380013
  ];
380014
380014
  const isToastErrorMessage = (code)=>{
380015
- if (false) {}
380015
+ if (true) {
380016
+ return true;
380017
+ }
380016
380018
  return code && TOAST_ERROR_WHITE_LIST.includes(code);
380017
380019
  };
380018
380020
  const CODE_JINJA_FORMAT_ERROR = 700012059;
@@ -392833,7 +392835,7 @@ const JsonViewerWithFilter = /*#__PURE__*/ (0,react.memo)((param)=>{
392833
392835
  children: /*#__PURE__*/ (0,jsx_runtime.jsx)(CalypsoLazy, {
392834
392836
  markDown: content,
392835
392837
  imageOptions: {
392836
- forceHttps: !undefined
392838
+ forceHttps: !true
392837
392839
  }
392838
392840
  })
392839
392841
  });
@@ -416113,7 +416115,7 @@ const useClearHistoryAdapter = (param)=>{
416113
416115
  }
416114
416116
  ];
416115
416117
  const config = {
416116
- url: false ? 0 : '/v1/conversation/create',
416118
+ url: true && chatConfig.source === open_OpenApiSource.ChatFlow ? '/v1/workflow/conversation/create' : '/v1/conversation/create',
416117
416119
  method: 'POST',
416118
416120
  hooks: {
416119
416121
  onBeforeRequest: [
@@ -432535,24 +432537,23 @@ const createOrGetConversation = async (apiSdk, props)=>{
432535
432537
  // @ts-expect-error -- linter-disable-autofix
432536
432538
  sectionId = res.last_section_id;
432537
432539
  } else {
432538
- if (false) { var _props_project3, _props_project2, _props_workflow, _res_data1, _res_data, _props_project1 } else {
432539
- var _props_project4, _props_project5, _props_project6, _props_workflow1;
432540
- const res = await (apiSdk === null || apiSdk === void 0 ? void 0 : apiSdk.conversations.create({
432541
- // @ts-expect-error -- linter-disable-autofix
432542
- app_id: (_props_project4 = props.project) === null || _props_project4 === void 0 ? void 0 : _props_project4.id,
432543
- conversation_name: props === null || props === void 0 ? void 0 : (_props_project5 = props.project) === null || _props_project5 === void 0 ? void 0 : _props_project5.conversationName,
432540
+ if (true) {
432541
+ var _props_project1, _props_project2, _props_project3, _props_workflow, _res_data, _res_data1;
432542
+ const res = await (apiSdk === null || apiSdk === void 0 ? void 0 : apiSdk.post('/v1/workflow/conversation/create', {
432543
+ app_id: (_props_project1 = props.project) === null || _props_project1 === void 0 ? void 0 : _props_project1.id,
432544
+ conversation_name: props === null || props === void 0 ? void 0 : (_props_project2 = props.project) === null || _props_project2 === void 0 ? void 0 : _props_project2.conversationName,
432544
432545
  get_or_create: true,
432545
- draft_mode: (props === null || props === void 0 ? void 0 : (_props_project6 = props.project) === null || _props_project6 === void 0 ? void 0 : _props_project6.mode) === 'draft',
432546
- workflow_id: props === null || props === void 0 ? void 0 : (_props_workflow1 = props.workflow) === null || _props_workflow1 === void 0 ? void 0 : _props_workflow1.id,
432546
+ draft_mode: (props === null || props === void 0 ? void 0 : (_props_project3 = props.project) === null || _props_project3 === void 0 ? void 0 : _props_project3.mode) === 'draft',
432547
+ workflow_id: props === null || props === void 0 ? void 0 : (_props_workflow = props.workflow) === null || _props_workflow === void 0 ? void 0 : _props_workflow.id,
432547
432548
  connector_id: getConnectorId(props)
432548
- }, {
432549
+ }, false, {
432549
432550
  headers: {
432550
432551
  'Accept-Language': intl.language === 'zh-CN' ? 'zh' : 'en'
432551
432552
  }
432552
432553
  }));
432553
- conversationId = (res === null || res === void 0 ? void 0 : res.id) || '';
432554
- sectionId = (res === null || res === void 0 ? void 0 : res.last_section_id) || '';
432555
- }
432554
+ conversationId = (res === null || res === void 0 ? void 0 : (_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.id) || '';
432555
+ sectionId = (res === null || res === void 0 ? void 0 : (_res_data1 = res.data) === null || _res_data1 === void 0 ? void 0 : _res_data1.last_section_id) || '';
432556
+ } else { var _props_project6, _props_workflow1, _props_project5, _props_project4 }
432556
432557
  }
432557
432558
  return {
432558
432559
  conversationId,
@@ -434184,6 +434185,7 @@ class AuthClient {
434184
434185
  // 新增这一行
434185
434186
 
434186
434187
 
434188
+ // eslint-disable-next-line import/no-extraneous-dependencies -- @coze-common/assets 是 rspack 路径别名,指向本地资源目录
434187
434189
 
434188
434190
 
434189
434191
 
@@ -434253,7 +434255,7 @@ class WebChatClient {
434253
434255
  WebChatClient.clients = WebChatClient.clients.filter((c)=>c !== this);
434254
434256
  }
434255
434257
  constructor(options){
434256
- var _this_options_config, _this_options_config1;
434258
+ var _this_options, _this_options1;
434257
434259
  client_define_property(this, "root", void 0);
434258
434260
  client_define_property(this, "defaultRoot", void 0);
434259
434261
  client_define_property(this, "containerEl", void 0); // 新增:保存容器元素
@@ -434269,8 +434271,8 @@ class WebChatClient {
434269
434271
  this.options = client_formatOptions(options);
434270
434272
  this.authClient = new AuthClient(options);
434271
434273
  // 计算最终使用的 API 地址
434272
- const env = (_this_options_config = this.options.config) === null || _this_options_config === void 0 ? void 0 : _this_options_config.env;
434273
- this.apiUrl = getApiUrl((_this_options_config1 = this.options.config) === null || _this_options_config1 === void 0 ? void 0 : _this_options_config1.apiUrl, env);
434274
+ const env = (_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.env;
434275
+ this.apiUrl = getApiUrl((_this_options1 = this.options) === null || _this_options1 === void 0 ? void 0 : _this_options1.apiUrl, env);
434274
434276
  console.info('WebChatClient using API URL:', this.apiUrl, env);
434275
434277
  // 👇 新增:处理 getContainer
434276
434278
  const { getContainer, mode = 'float' } = this.options;