"Unexpected token < in JSON at position 0."

When I use aspose word cloud node, I often get the error ‘Unexpected token<in JSON at position 0.’ and occasionally get the error ‘aborted’. Please tell me the reason for this type of error, and I cannot rule out the specific reason.

And how can I view the interfaces that failed calls? I don’t see any failed calls on the dashboard, but in fact, 10% of my calls failed

@Uino

I am afraid we have not noticed any such errors. Please ensure you are using the latest version of Aspose.Words Cloud SDK for Node. If the issue persists, then kindly share your sample script for investigation.

I am sure my version is the latest version, 23.3.0, but this error seems to occur randomly. There is a certain content that is bound to make such an error. This content will not make an error in your official website example, but calling the interface will inevitably make an error. I can test the content for you to see

Summary
 <!DOCTYPE html>
Blog html, body { font-size: 16px; }
.content,
#htmlContent {
  letter-spacing: 0px;
}

#htmlContent figcaption {
  padding: 6px 0 !important;
  margin: 0px !important;
}

#htmlContent ul,
#htmlContent ol {
  list-style: disc;
}

.content-code pre,
.content pre,
#htmlContent pre {
  padding: 0px !important;
}

.content-table table,
.content table,
#htmlContent table {
  line-height: 1.0 !important;
  width: 14.64cm !important;
  margin: 0 auto !important;
  color: #000;
}

#htmlContent table td,
.content table td,
.content-table table td {
  height: 0.5cm !important;
  line-height: 1.0 !important;
}

.content-title h1,
.content h1,
#htmlContent h1,
.content-title h2,
.content h2,
#htmlContent h2,
.content-title h3,
.content h3,
#htmlContent h3,
.content-title h4,
.content h4,
#htmlContent h4,
.content-title h5,
.content h5,
#htmlContent h5,
.content-title h6,
.content h6,
#htmlContent h6 {
  color: #000;
}

.content-code pre code,
.content pre code,
#htmlContent pre code {
  color: #000;
}

.content-todo-list .todo-list__label>input:before,
.content .todo-list__label>input:before,
#htmlContent .todo-list__label>input:before {
  border: 1px solid #000;
}

.content-tag blockquote,
.content blockquote,
#htmlContent blockquote {
  color: #000;
}

#htmlContent figcaption {
  color: #000;
}

🚩注意:

建筑层级不可摆放设备。

单击左侧楼层按钮,展开楼层列表,可点击跳转至任一楼层页面,可为该楼层内任一房间摆放设备。点击当前楼层按钮,展开楼层列表,可切换至其它楼层。点击按钮,返回园区页面,点击按钮,返回上一层级。

模型摆放

可在模型库的搜索栏中输入设备名称进行搜索,模型管理中导入的模型文件也可在模型库中查看摆放。

将模型摆放至场景内,通过调整按钮可对设备进行位置调整,拖拽设备周围的小方块可调整模型大小,页面上方的编辑工具栏可对摆放设备进行编辑。

按钮的详细操作及功能描述如下表所述:

图标 功能 描述
  调整垂直高度 拖动鼠标可上下移动,调整当前物体的垂直位置,按住shift等比例调整
  调整水平位置 拖动鼠标可移动物体在水平平面的位置,按住shift等比例调整
  调整旋转角度 拖动鼠标可调整物体的水平旋转角度,按住shift等比例调整
  删除 删除当前选中模型
  锁定 模型锁定后不可编辑
  批量复制 对当前设备进行批量复制,鼠标移动位置确定设备的排列方向,ctrl+鼠标滚轮调整设备间距
  复制 复制当前选中设备
  组合 可选中多个模型组合成一个孪生体进行管理,选中后再次点击即可解组
  替换模型 替换当前模型,在模型库中选择要替换的模型,可勾选是否保留原有尺寸
  垂直翻转 对当前模型进行垂直翻转
  水平翻转 对当前模型进行水平翻转

对摆放设备的大小、位置进行调整,有两种方法:

①在编辑工具栏中对模型长、宽、高、离地高度、角度等数据进行改动,点击按钮,可对模型尺寸比例进行锁定,比如,修改模型长度后,模型宽度和高度会自动按比例改动;点击按钮,可将角度数据一键置0;

②对模型进行调整,按住模型周围方块进行拖动,可调整模型的长、宽、高,按住其中任一按钮,可对模型的位置、离地高度、角度进行调整,按住shift调整周围方块,可等比例调整模型的长宽高;

点击,从本地上传参考图,可按参考图位置摆放设备,暂不支持圈地画墙操作;

参考图上传后,可对其进行调整编辑。每一层级只能导入一张参考图(同一楼层仅支持一张参考图),参考图仅在点位摆放中显示。

上图编辑栏从左到右依次为:

  • 显示参考图:默认勾选,勾选后显示参考图;
  • 参考图透明度:可拖动或输入透明度;
  • 旋转参考图:输入参考图的旋转角度,旋转角度以0°为参考,逆时针旋转;
  • 离地高度:参考图距离地面高度,以米为单位;
  • 设置比例尺:调整参考图大小;
  • 移动参考图:点击后拖动参考图移动;
  • 替换参考图;点击后本地上传其它图纸,可保留原图的位置与比例尺;
  • 删除:删除该参考图;

点击,摆放空点位起到占位作用,点击以待用定制好的模型进行替换,替换时可保留原有尺寸。

摆放好模型后,在编辑工具栏中,单击属性按钮,打开属性页面,可填写孪生体ID(不可重复)、名称、选择孪生体分类、物体类型(普通物体或摄像头),也可点击【新增】按钮,新增自定义属性名(不能重复)和属性值。如图所示,孪生体ID孪生体分类名称为必填项,其他属性根据实际情况填写。

摄像头设备需选择物体类型为“摄像头”。

  • 显示视锥:勾选后展示摄像头视野的覆盖范围;
  • 视野距离:摄像头照射范围的最远距离;
  • 视野角度:摄像头的开合角度;
  • 设备倾角:摄像头角度与水平面之间的夹角;
  • 剔除遮挡:勾选后,碰到障碍物会剔除覆盖范围;
  • 视频源:视频地址来源;

💡技巧:

批量复制模型或多选模型(按住shift,鼠标点击)后,点击属性按钮,可批量设置孪生体属性

 

  • 孪生体ID:起始编号必填,如批量复制三个烟感,前缀填“烟感”,起始编号填写为“1”,此时批量复制的孪生体名称依次命名为“烟感1”、“烟感”2”“烟感3”,后缀填“烟感”,则孪生体名称为“1烟感”、“2烟感”、“3烟感”。
  • 名称:单击名称同孪生体ID按钮,无需设置名称,名称保持与孪生体ID相同;勾选批量设置,名称设置方式参考孪生体ID的批量设置方式;不勾选批量设置,输入名称,则所有孪生体名称相同。

单击效果分类可为设备选择效果分类标签,效果分类标签会影响模型在效果模板下的显示效果,优先使用系统提供的标签,自定义标签可能会影响模型的效果展示。“小品”代表不使用效果模板。下图左为园区下的效果分类标签,右为进入楼层后的效果分类标签。

 

单击确定后,弹出“属性设置成功”的提示,单击孪生体,孪生体分类列表下会显示设置后的模型。

所有点位摆放成功后点击左上角

📚说明:

摆放的模型若没有进行属性设置,单击保存会进入孪生体的草稿数据中,草稿数据不会保存,退出摆放器后将清空草稿数据。

单击按钮,展开孪生体分类列表,列表下显示已摆放的模型,单击孪生体分类的顶牌按钮,在场景中对应分类下的孪生体设备会显示顶牌,再次点击顶牌消失。

单击定位按钮,可快速聚焦到该设备。

绘制管线

(1)单击线路按钮,在园区场景内绘制管线,点击鼠标右键完成绘制。

(2)右键退出线路模式,单击选中线路,调整线路样式,进行属性设置和效果分类,具体填写见上节模型摆放,线路保存成功后会含有“园区空间数据”。

(3)片状线可对线路类型进行更改,默认为管线;【尺寸】可调整线路粗细;【离地高度】可调整线路的离地高度;勾选【显示箭头】可查看线路方向;单击【反向】按钮可调整线路方向;选择【颜色】可为线路调整颜色;单击【复制】可复制当前线路;单击【锁定】无法选中编辑线路;单击【删除】,删除该线路。

添加分类

(1)搜索框中通过搜索孪生体ID来查找该模型,单击+可新增孪生体分类。

(2)在新增孪生体分类的弹窗中,输入分类名称单击确定,孪生体列表下会新增一个通用孪生体分类。

(3)可在孪生体管理模块下查看新增的孪生体分类及摆放的设备信息。

@Uino

Please zip your input document and share it with us with your sample code. We will try to replicate the issue and guide you accordingly.

example.zip (20.4 KB)
This is my example

1、execute "yarn "

2、Enter your access code into the index.mjs

3、execute “node index.mjs”

@Uino

Thanks for sharing the sample document. It seems to be a document related issue, as I am getting an ESOCKETTIMEDOUT error for the conversion. So I have logged a ticket (WORDSCLOUD-2322) for further investigation. We will notify you as soon as we fix the problem.

I have also encountered ESOCKETTIMEOUT errors, sometimes aborted, and most importantly, the error I frequently encounter is’ Unexpected token<in JSON at position 0. 'Please pay close attention to this

Also, I wasted the number of request calls due to these error reports. Can you help me waive the cost

@Uino

In multiple calls, I did not find the Unexpected Token error. However, we will investigate it as well.

@Uino

Please note that failed API calls are not billed. However, if you have noticed some different behavior, then please share the details.

So do you have a solution for the ESOCKETTIMEOUT error

@Uino

We have investigated the WORDSCLOUD-2322 issue and noticed that example.html contains a lot of links to external resources that are causing the ESOCKETTIMEDOUT error.

Please note that the Words Cloud API is forbidden from using data from the internet; it uses data stored on internal storage only. Please remove all the links to external resources. If you need some additional files, load them too. But please ensure that the additional files don’t have external links.

Thank you for your clarification. By the way, what is the size limit for a single request

@Uino

Please note that we don’t have any limitations on file size, but each container(node) has limited memory. Memory consumption depends upon the file structure, as sometimes a 10MB file can take 1GB in memory while processed, and 100MB can take from 100MB to a huge number. You can try the conversion with your big flies; however, if you face any issues, you can share your input document via some free file sharing service with us for investigation.