当前位置: 首页 > news >正文

NetSuite AI 图生代码

去年的ChatGPT热潮期间,我们写过一篇文章说GTP辅助编程的事。

NetSuite GPT的辅助编程实践_如何打开netsuite: html script notes的视图-CSDN博客文章浏览阅读2.2k次,点赞4次,收藏3次。作为GPT综合症的一种表现,我们今朝来探究下GPT会不会抢了我们SuiteScript的编程饭碗,以及如何与之相处。_如何打开netsuite: html script notes的视图https://nk-community.blog.csdn.net/article/details/130167144一年之后的今天,具备“图生代码”的ChatGPT 4o更加令人激动。

ChatGPT图生NetSuite代码 2024-08-29

这个场景是当我们想构建如下的Suitelet界面时,可以通过ChatGPT的“图生代码”功能来生成“粗代码”。所谓粗代码就是代码的毛坯件,里面可能存在错误、不达意之处,但是大部分是可以用的。

当我们把这个图喂给ChatGPT时,它输出的代码如下。

/*** @NApiVersion 2.x* @NScriptType Suitelet*/
define(['N/ui/serverWidget', 'N/email', 'N/runtime', 'N/redirect', 'N/task'], 
function(serverWidget, email, runtime, redirect, task) {function onRequest(context) {if (context.request.method === 'GET') {// Create the formvar form = serverWidget.createForm({title: 'Management Report'});// Add Periods field groupform.addFieldGroup({id: 'periods',label: 'Periods'});// Add Options field groupform.addFieldGroup({id: 'options',label: 'Options'});// Add Notice field groupform.addFieldGroup({id: 'notice',label: 'Notice'});// Add Start Period fieldform.addField({id: 'custpage_start_period',type: serverWidget.FieldType.SELECT,label: 'START PERIOD',container: 'periods'}).addSelectOption({ value: 'Aug 2024', text: 'Aug 2024', isSelected: true });  // Example option// Add End Period fieldform.addField({id: 'custpage_end_period',type: serverWidget.FieldType.SELECT,label: 'END PERIOD',container: 'periods'}).addSelectOption({ value: 'Aug 2024', text: 'Aug 2024', isSelected: true });  // Example option// Add checkboxes for sheets in the Options groupform.addField({id: 'custpage_sheet_start_to_end',type: serverWidget.FieldType.CHECKBOX,label: 'Sheet – Data During START PERIOD to END PERIOD',container: 'options'});form.addField({id: 'custpage_sheet_year_to_end',type: serverWidget.FieldType.CHECKBOX,label: 'Sheet – Data During Year Beginning to END PERIOD',container: 'options'});form.addField({id: 'custpage_sheet_end',type: serverWidget.FieldType.CHECKBOX,label: 'Sheet – Data in END PERIOD',container: 'options'});// Add Notice field in the Notice groupform.addField({id: 'custpage_notice',type: serverWidget.FieldType.INLINEHTML,label: ' ',container: 'notice'}).defaultValue = "<p style='color:#999;'>After you click the Generate Report & Email Button, you can close the window.<br>It would take 3-5 minutes to generate the report and Email to you.</p>";// Add Generate Report & Email Buttonform.addSubmitButton({label: 'Generate Report & Email'});// Write the form to the responsecontext.response.writePage(form);} else {// Handle POST request to generate the reportvar startPeriod = context.request.parameters.custpage_start_period;var endPeriod = context.request.parameters.custpage_end_period;var includeSheetStartToEnd = context.request.parameters.custpage_sheet_start_to_end === 'T';var includeSheetYearToEnd = context.request.parameters.custpage_sheet_year_to_end === 'T';var includeSheetEnd = context.request.parameters.custpage_sheet_end === 'T';// Logic to generate and email the report// This would involve creating a script task or similar to process the report in the backgroundvar reportTask = task.create({taskType: task.TaskType.MAP_REDUCE,scriptId: 'customscript_generate_report_mr',  // Replace with your Map/Reduce script IDdeploymentId: 'customdeploy_generate_report_mr',  // Replace with your deployment IDparams: {custscript_start_period: startPeriod,custscript_end_period: endPeriod,custscript_include_sheet_start_to_end: includeSheetStartToEnd,custscript_include_sheet_year_to_end: includeSheetYearToEnd,custscript_include_sheet_end: includeSheetEnd}});var reportTaskId = reportTask.submit();// Redirect or show confirmation pagecontext.response.write('The report is being generated and will be emailed to you shortly.');}}return {onRequest: onRequest};
});

这段代码除了有一个问题外,基本可用。

就是ChatGPT没有很好的理解"布局",所以Periods和Options这两个FieldGroup没有并列排布。即使在重复提示它进行调整后,依然没有处理好。这说明语料库中,缺乏此部分的知识。

咨询了我们的开发顾问,他们认为通过图生代码的功能,可以节省一些重复代码的编写时间,这种辅助编程的方法是可用的。

这,就是一年间的AI变化。

不过同样的提示词,在Claudy,文心上表现的很二次元。大家一试便知。

如果有任何关于NetSuite的问题,欢迎来谈。邮箱:service@truston.group

http://www.lryc.cn/news/432048.html

相关文章:

  • Java - BigDecimal计算中位数
  • Tensorflow2如何读取自制数据集并训练模型?-- Tensorflow自学笔记13
  • JVM系列(七) -对象的内存分配流程
  • Apache Ignite 在处理大规模数据时有哪些优势和局限性?
  • 怎么利用NodeJS发送视频短信
  • WebAPI(三)、 DOM 日期对象Date;获取事件戳;根据节点关系查找节点
  • 012.Oracle-索引
  • SSL 证书 | 免费获取与自动续期全攻略
  • 达梦数据库管理员常用SQL(一)
  • HttpUtils工具类(三)OKHttpClient使用详细教程
  • 重生奇迹MU老大哥剑士职业宝刀未老
  • 关于Netty详细介绍,Netty原理架构解析
  • 在Unity环境中使用UTF-8编码
  • 零工市场小程序:自由职业者的日常工具
  • 【Http 每日一问,访问服务端的鉴权Token放在header还是cookie更合适?】
  • vue2+ueditor集成秀米编辑器
  • [网络]HTTP协议 Cookie与Session
  • 安宝特科技 | AR眼镜在安保与安防领域的创新应用及前景
  • 2024 第十二届重庆国际植保双交会暨新型肥料农药产业博览会
  • 用“说”智能控制灯具开关语音识别芯片NRK3603
  • APS开源源码解读: 排程工具 optaplanner
  • AMEYA360:村田量产用于汽车市场的高可靠性0603M铜电极负温度系数NTC热敏电阻
  • 代码随想录第十天|150.逆波兰表达式求值 239.滑动窗口的最大值 347.前K个高频元素
  • [阅读笔记]《解读基金—我的投资观与实践》— 季凯帆
  • 2.3之前
  • 处理器基础知识——cache
  • 操作系统的运行环境
  • 如何在 Selenium 中获取网络调用请求?
  • IP学习——oneday
  • 2024 年高教社杯全国大学生数学建模竞赛 C 题 农作物的种植策略(详细思路+matlab代码+python代码+论文范例)