新增教育咨询

This commit is contained in:
weipengfei 2023-09-26 13:49:59 +08:00
parent 004a1a1fe3
commit 43c75b62fd
8 changed files with 9 additions and 150 deletions

View File

@ -1,6 +1,6 @@
{ {
"name" : "农业咨询", "name" : "教育咨询",
"appid" : "__UNI__9620511", "appid" : "__UNI__7AA205C",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",

View File

@ -3,7 +3,7 @@
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "农业咨询", "navigationBarTitleText": "教育咨询",
"bounce": "none" "bounce": "none"
// "softinputMode": "adjustResize" // "softinputMode": "adjustResize"
} }

View File

@ -52,8 +52,8 @@
}, },
data() { data() {
return { return {
wssType: 'nongye', // wssType: 'jiaoyu', //
avatarType: "/static/icon/ny.png", // AI avatarType: "/static/icon/jy.png", // AI
talkList: [], talkList: [],
ajax: { ajax: {
rows: 15, // rows: 15, //

141
test.js
View File

@ -1,141 +0,0 @@
$.ajax({
                url: host,
                data: data,
                type: "POST",
                dataType: "json",
                headers: headers,
                complete: () => {
                    let message = ai.lastMessage(chat);
                    if (!chat.loading || message.id !== lastId) {
                        return;
                    }
                    chat.lastChunkIndex = 0;
                    chat.loading = false;
                    lastMessage.completed = true;
                    ai.saveData();
                },
                success: function (res) {
                    let message = ai.lastMessage(chat);
                    if (!chat.loading || message.id !== lastId) {
                        return;
                    }
                    if (res && res.error && res.error.message) {
                        ai.lastMessage(chat).choices[0].delta.content = res.error.message;
                    } else if (res && res.data && res.data[0] && res.data[0].url) {
                        ai.lastMessage(chat).choices[0].delta.content = `![](${res.data[0].url})`;
                    } else {
                        console.log(res);
                    }
                },
                xhr: this.xhrOnProgress(function (event) {
                    let message = ai.lastMessage(chat);
                    // 已经取消
                    if (!chat.loading || message.id !== lastId) {
                        return;
                    }
                    const xhr = event.target;
                    const {responseText} = xhr;
                    let thunks = responseText.substring(chat.lastChunkIndex);
                    chat.lastChunkIndex = responseText.length;
                    const arr = thunks.split("\n");
                    arr.forEach(function (chunk) {
                        if (chunk === "") return;
                        chunk = chunk.substring(6).trim();
                        if (chunk === "" || chunk === "[DONE]") return;
                        tr
// uni.request({
// url: 'https://ceshi-worker-task.lihaink.cn/api/xun_fei/chat?content=uniapp中js的回调有哪些',
// method: 'GET',
// responseType: 'arraybuffer',
// success: res => {
// console.log(res);
// },
// fail: err => {
// // 处理请求失败
// console.error(err);
// }
// });
// let that = this;
// this.talkList.push({
// "id":new Date().getTime(),
// "content":'',
// "type":2,
// "pic":"/static/avatar.png"
// });
// var xhr = new XMLHttpRequest();
// xhr.open('GET', 'https://ceshi-worker-task.lihaink.cn/api/xun_fei/chat?content=uniapp中js的回调有哪些', true); // 设置请求方法、URL 和是否异步
// xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
// xhr.onreadystatechange = function() {
// console.log('请求成功:', xhr.responseText);
// that.talkList[that.talkList.length-1].content += xhr.responseText;
// };
// xhr.send();
// fetch('https://ceshi-worker-task.lihaink.cn/api/xun_fei/chat?content=uniapp中js的回调有哪些')
// .then(response => response.body)
// .then(data => {
// // 在这里处理返回的数据
// console.log(data);
// })
// .catch(error => {
// // 在这里处理请求错误
// console.error(error);
// });
// let that = this;
// this.talkList.push({
// "id":new Date().getTime(),
// "content":'',
// "type":2,
// "pic":"/static/avatar.png"
// });
// axios({
// method: 'get',
// url: 'https://ceshi-worker-task.lihaink.cn/api/xun_fei/chat?content=uniapp中js的回调有哪些',
// responseType: 'text'
// })
// .then(response => {
// response.data.on('data', (chunk) => {
// // 处理流数据的逻辑
// console.log(chunk);
// });
// response.data.on('end', () => {
// // 数据接收完成的逻辑
// console.log('完成');
// });
// });
// fetch('https://ceshi-worker-task.lihaink.cn/api/xun_fei/chat?content=uniapp中js的回调有哪些') // 通过fetch获取一个Response对象
// .then(response => response.body.getReader()) // 获取ReadableStreamDefaultReader对象
// .then(reader => {
// function read() {
// return reader.read().then(({ done, value }) => {
// if (done) {
// console.log('读取完成');
// return;
// }
// const decoder = new TextDecoder();
// console.log(decoder.decode(value));
// that.talkList[that.talkList.length-1].content += decoder.decode(value);
// // console.log(value); // 输出读取到的数据
// // 继续读取下一块数据
// return read();
// });
// }
// return read(); // 开始读取数据
// })
// .catch(error => console.error(error));
// return ;

0
type.md Normal file
View File

View File

@ -1,8 +1,8 @@
var isReady=false;var onReadyCallbacks=[]; var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[]; var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/index/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"人工智能","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"农业咨询","compilerVersion":"3.8.12","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; var __uniConfig = {"pages":["pages/index/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"人工智能","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"教育咨询","compilerVersion":"3.8.12","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"农业咨询","bounce":"none"}}]; var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"教育咨询","bounce":"none"}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__9620511","name":"农业咨询","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"],"abiFilters":["armeabi-v7a","arm64-v8a","x86"]},"apple":{"dSYMs":false},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"uniStatistics":{"enable":false},"arguments":"{\"name\":\"\",\"path\":\"\",\"query\":\"\",\"id\":0}","allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.8.12","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}} {"@platforms":["android","iPhone","iPad"],"id":"__UNI__7AA205C","name":"教育咨询","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"],"abiFilters":["armeabi-v7a","arm64-v8a","x86"]},"apple":{"dSYMs":false},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"uniStatistics":{"enable":false},"arguments":"{\"name\":\"\",\"path\":\"\",\"query\":\"\",\"id\":0}","allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.8.12","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}}