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

net网站建设如何自学跨境电商

net网站建设,如何自学跨境电商,网络程序开发,运营和营销的区别和联系微信小程序_调用openAi搭建虚拟伙伴聊天背景效果关于账号注册接口实现8行python搞定小程序实现页面结构数据逻辑结速背景 从2022年的年底#xff0c;网上都是chagpt的传说#xff0c;个人理解这个chatgpt是模型优化训练#xff0c;我们在用chatgpt的时候就在优化这个模型网上都是chagpt的传说个人理解这个chatgpt是模型优化训练我们在用chatgpt的时候就在优化这个模型这个是付费的换言之我们都是chagpt的韭菜OpenAI 是一个研究组织chagpt是他们的一个产品工具。 带着好奇心做了个小程序的聊天页面。 效果 像个机器人聊天 关于账号注册 由于国内电话不支持绑定openAi的邮箱需要虚拟号码激活具体步骤网上都有教程 接口实现 8行python搞定 install openai获取apiKey调用即可向openai发送请求 def getOpenAiText(request):if request.method GET:text request.GET.get(text, default)responseText openai.Completion.create(modeltext-davinci-003,prompttext,max_tokens100,temperature0)return JsonResponse({data: responseText, code: 200,msg:success})return JsonResponse({data: {}, code: 0,msg:not allowed})小程序实现 设计思路灵感来源微信对话框模式一对一 只需要设计数据结构为 [{ question:‘’, answer:‘’, isEdit:false }] 可以显示问答的状态 在添加一个currentIndex标识编辑的状态遍历数字显示加上时间绑定即可实现 缓存采用storage。 页面结构 view classcontainer-futureview classform-container-apiviewbutton stylewidth: 100%; typeprimary formTypesubmitopenai调用/button/viewview classchat-containerview wx:for{{ chatObjConfig.option }} wx:for-indexindex wx:for-itemitem wx:keyindexview classform-requestview wx:if{{item.isEdit}}问$ input bindinputbindKeyInput placeholder输入关键词 data-column-index{{index}} disabled{{isLoading}} //view view wx:else classquestionedview问$ {{item.question}}/view/view/viewview classform-responseview classquestionedopenai回答$ {{item.answer}}/view/view/view/viewview classform-submitbutton stylewidth: 100%; typeprimary bindtapsearch loading{{isLoading}} disabled{{isLoading}}发送/button/view/viewview classloading wx:if{{isLoading}}view classloader-child /view classloader-child /view classloader-child //view /view数据逻辑 // pages/future/future.js const app getApp(); const baseUrl app.remoteConfig.baseUrl; Component({/*** 继承父级样式*/options: {addGlobalClass: true,},/***组件的初始数据*/data: {searchOpenAiText:,responseText:,// questionsanswerindexchatObjConfig:{option:[{question:,answer:,isEdit:true}],currentIndex:0}},lifetimes: {// 生命周期函数可以为函数或一个在 methods 段中定义的方法名attached: function () {if(wx.getStorageSync(openAiOptions)){this.setData({chatObjConfig:wx.getStorageSync(openAiOptions)})}},moved: function () { },detached: function () {wx.setStorageSync(openAiOptions, this.data.chatObjConfig)},},methods: {bindKeyInput(e) {const {columnIndex}e.currentTarget.datasetconsole.log(this.data.chatObjConfig,this.data.chatObjConfig)const optionthis.data.chatObjConfig.optionoption.some((item,index){if(columnIndexindex){item.questione.detail.valueitem.isEdittruereturn true}return false})this.setData({searchOpenAiText:e.detail.value,chatObjConfig:{option:option,currentIndex:columnIndex}})},search(e){console.log(this.data.searchOpenAiText)if(!this.data.searchOpenAiText){wx.showModal({cancelColor: cancelColor,title:请输入})}wx.showLoading({title: 加载中,})this.setData({isLoading: true})console.log(e)const path /common-api/searchOpenAiText/const headers { Content-Type: application/json;charsetUTF-8 }const params{text:this.data.searchOpenAiText}const thisBackthisreturn new Promise((resolve, reject) {wx.request({url: baseUrl path,headers: headers,data:params,method: GET,success: (res) {console.log(res,res)const datares.data.dataconst optionthisBack.data.chatObjConfig.optionconst currentIndexthisBack.data.chatObjConfig.currentIndexconst choicesdata.choicesconsole.log(choices,choices)option.some((item,index){if(currentIndexindex){item.answerchoices?choices.map(choicesItem{return choicesItem.text}).join(\n):。。。未知item.isEditfalsereturn true}return false})const chatObjConfig{option:option,currentIndex:currentIndex1}option.push({question:,answer:,isEdit:true})thisBack.setData({isLoading: false,chatObjConfig:chatObjConfig})setTimeout(function () {wx.hideLoading()}, 2000)resolve(res)},fail: error {thisBack.setData({isLoading: false})setTimeout(function () {wx.hideLoading()}, 2000)reject(error)}});})}} })结速 最后我的小程序yma16 欢迎大家访问
http://www.sczhlp.com/news/215835/

相关文章:

  • 企业建站wordpress怎么创立网站
  • 腾讯企业邮箱网页版登录入口官网做网站分为竞价和优化
  • 手工制作网站做网站找合作伙伴
  • 青岛建站模板厂家郑州app开发公司定制外包
  • 爱站seo综合查询莱阳市规划建设局网站
  • 北京食药局网站年检怎么做网页设计作业10个页面
  • lnmp搭建网站超市库存管理软件
  • 自己做自媒体在哪个网站比较好长沙望城建设局网站
  • python做问卷调查的网站wordpress安装主题后打不开
  • 中移建设 网站网站建设难学吗
  • 贵阳的网站建设公司微设计公司网站
  • 专门做杂志的网站桐乡住房和城乡规划建设局网站
  • 深圳设计网站培训班免费做自己的网站
  • 网站建设吉金手指排名13西部数码网站管理助手 2008
  • 中山东莞网站推广河南工程建设协会网站
  • dedecms公司网站怎么做手机设计网
  • 做淘宝保健品药品在哪个网站找素材手机app开发软件制作
  • 网站制作网站开发公司企业网站背景图片
  • 网站建设不能在淘宝发布wordpress经典博客主题
  • 2025年10月防脱生发产品推荐榜:十款临床验证口碑对比
  • 2025 年国内优质不锈钢厂家最新推荐排行榜:含沈阳/东三省区域及水箱油罐等产品优质服务商楼梯/激光切割/桥梁杆/真空罐/扶手不锈钢厂家推荐
  • 2025 顶管源头厂家最新推荐榜单:F 型混凝土 / 水泥 / 电力 / 矩形 / 市政排水大口径优质供应商精选
  • 网站pc端网址和手机端网址建设优质公司网站
  • 中国10大装修公司排名延庆网站建设优化seo
  • 网站开发公司基本业务流程图黄河口信息港
  • 大连开发区邮编seo按天计费系统源码
  • 做外贸怎么上国外网站成都app开发
  • 一个企业网站的建设流程互联网技术试验卫星
  • 网站的布局方式有哪些内容我被朋友拉进彩票网站说做代理
  • 长春网站建设模板制作pc做网站