Forráskód Böngészése

other:尝试增加chatGPT聊天功能

lantian 1 éve
szülő
commit
9ddf057653
93 módosított fájl, 540 hozzáadás és 0 törlés
  1. 1 0
      src/main/java/com/tao/config/WebMVCConfig.java
  2. 98 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/html/chatlog.html
  3. 43 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/html/find.html
  4. 72 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/html/getmsg.json
  5. 218 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/html/msgbox.html
  6. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/default.png
  7. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/0.gif
  8. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/1.gif
  9. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/10.gif
  10. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/11.gif
  11. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/12.gif
  12. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/13.gif
  13. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/14.gif
  14. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/15.gif
  15. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/16.gif
  16. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/17.gif
  17. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/18.gif
  18. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/19.gif
  19. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/2.gif
  20. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/20.gif
  21. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/21.gif
  22. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/22.gif
  23. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/23.gif
  24. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/24.gif
  25. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/25.gif
  26. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/26.gif
  27. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/27.gif
  28. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/28.gif
  29. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/29.gif
  30. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/3.gif
  31. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/30.gif
  32. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/31.gif
  33. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/32.gif
  34. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/33.gif
  35. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/34.gif
  36. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/35.gif
  37. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/36.gif
  38. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/37.gif
  39. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/38.gif
  40. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/39.gif
  41. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/4.gif
  42. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/40.gif
  43. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/41.gif
  44. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/42.gif
  45. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/43.gif
  46. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/44.gif
  47. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/45.gif
  48. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/46.gif
  49. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/47.gif
  50. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/48.gif
  51. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/49.gif
  52. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/5.gif
  53. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/50.gif
  54. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/51.gif
  55. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/52.gif
  56. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/53.gif
  57. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/54.gif
  58. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/55.gif
  59. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/56.gif
  60. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/57.gif
  61. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/58.gif
  62. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/59.gif
  63. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/6.gif
  64. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/60.gif
  65. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/61.gif
  66. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/62.gif
  67. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/63.gif
  68. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/64.gif
  69. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/65.gif
  70. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/66.gif
  71. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/67.gif
  72. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/68.gif
  73. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/69.gif
  74. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/7.gif
  75. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/70.gif
  76. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/71.gif
  77. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/8.gif
  78. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/9.gif
  79. 1 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/layim.css
  80. 1 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/lib/layer-mobile.js
  81. 2 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/lib/layim-mobile-open.js
  82. 1 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/lib/layim-mobile.js
  83. 1 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/lib/zepto.js
  84. 1 0
      src/main/resources/static/layui/modules/layim/dist/layim-assets/mobile.css
  85. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/1.jpg
  86. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/2.jpg
  87. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/3.jpg
  88. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/4.jpg
  89. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/5.jpg
  90. BIN
      src/main/resources/static/layui/modules/layim/dist/layim-assets/voice/default.mp3
  91. 1 0
      src/main/resources/static/layui/modules/layim/dist/layim.js
  92. 90 0
      src/main/resources/templates/chatgpt.html
  93. 10 0
      src/main/resources/templates/index.html

+ 1 - 0
src/main/java/com/tao/config/WebMVCConfig.java

@@ -22,6 +22,7 @@ public class WebMVCConfig implements WebMvcConfigurer {
     public void addViewControllers(ViewControllerRegistry registry) {
         registry.addViewController("/").setViewName("index");
         registry.addViewController("/addElement").setViewName("add");
+        registry.addViewController("/chatGPT").setViewName("chatgpt");
     }
 
     @Override

+ 98 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/html/chatlog.html

@@ -0,0 +1,98 @@
+ 
+ 
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+<title>聊天记录</title>
+
+<link rel="stylesheet" href="//unpkg.com/layui/dist/css/layui.css">
+<style>
+body .layim-chat-main{height: auto;}
+</style>
+</head>
+<body>
+
+<div class="layim-chat-main">
+  <ul id="LAY_view"></ul>
+</div>
+
+<div id="LAY_page" style="margin: 0 10px;"></div>
+
+
+<textarea title="消息模版" id="LAY_tpl" style="display:none;">
+{{# layui.each(d.data, function(index, item){
+  if(item.id == layui.layim.cache().mine.id){ }}
+    <li class="layim-chat-mine"><div class="layim-chat-user"><img src="{{ item.avatar }}"><cite><i>{{ layui.data.date(item.timestamp) }}</i>{{ item.username }}</cite></div><div class="layim-chat-text">{{ layui.layim.content(item.content) }}</div></li>
+  {{# } else { }}
+    <li><div class="layim-chat-user"><img src="{{ item.avatar }}"><cite>{{ item.username }}<i>{{ layui.data.date(item.timestamp) }}</i></cite></div><div class="layim-chat-text">{{ layui.layim.content(item.content) }}</div></li>
+  {{# }
+}); }}
+</textarea>
+
+<!-- 
+上述模版采用了 laytpl 语法
+
+-->
+
+
+<script src="//unpkg.com/layui/dist/layui.js"></script>
+<script>
+layui.link('../layim.css', 'skinlayimcss') //加载 css
+layui.config({
+  layimPath: '../../' //配置 layim.js 所在目录
+  ,layimAssetsPath: '../../layim-assets/' //layim 资源文件所在目录
+}).use(['jquery'], function(){
+  var layim = parent.layui.layim
+  ,laytpl = parent.layui.laytpl
+  ,$ = layui.jquery
+  ,laypage = parent.layui.laypage;
+  
+  //聊天记录的分页此处不做演示,你可以采用 laypage
+  
+  //开始请求聊天记录
+  var param =  location.search //获得URL参数。该窗口url会携带会话id和type,他们是你请求聊天记录的重要凭据
+  
+  //实际使用时,下述的res一般是通过Ajax获得,而此处仅仅只是演示数据格式
+  ,res = {
+    code: 0
+    ,msg: ''
+    ,data: [{
+      username: '纸飞机'
+      ,id: 100000
+      ,avatar: '' || layui.cache.layimAssetsPath + 'images/default.png'
+      ,timestamp: 1480897882000
+      ,content: '我方模拟记录111'
+    }, {
+      username: 'test123'
+      ,id: 108101
+      ,avatar: '' || layui.cache.layimAssetsPath + 'images/default.png'
+      ,timestamp: 1480897892000
+      ,content: '对方模拟记录111'
+    },{
+      username: 'test123'
+      ,id: 108101
+      ,avatar: '' || layui.cache.layimAssetsPath + 'images/default.png'
+      ,timestamp: 1480897898000
+      ,content: '对方模拟记录222'
+    },{
+      username: 'test123'
+      ,id: 108101
+      ,avatar: '' || layui.cache.layimAssetsPath + 'images/default.png'
+      ,timestamp: 1480897908000
+      ,content: '注意:这些都是模拟数据,实际使用时,需将其中的模拟接口改为你的项目真实接口。\n该模版文件所在目录(相对于layim.js):\n/layim-assets/html/chatlog.html'
+    }]
+  }
+  
+  //console.log(param)
+  
+  var html = laytpl(LAY_tpl.value).render({
+    data: res.data
+  });
+  $('#LAY_view').html(html);
+  
+});
+</script>
+</body>
+</html>

+ 43 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/html/find.html

@@ -0,0 +1,43 @@
+ 
+ 
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+<title>发现</title>
+
+<link rel="stylesheet" href="//unpkg.com/layui/dist/css/layui.css">
+<style>
+
+</style>
+</head>
+<body>
+
+<div style="margin: 15px;">
+  <blockquote class="layui-elem-quote">此为自定义的【查找】页面,因需求不一,所以官方暂不提供该模版结构与样式,实际使用时,可移至该文件到你的项目中,对页面自行把控。
+  <br>文件所在目录(相对于layui.js):/layim-assets/html/find.html</blockquote>
+</div>
+
+
+
+<script src="//unpkg.com/layui/dist/layui.js"></script>
+<script>
+layui.config({
+  layimPath: '../../' //配置 layim.js 所在目录
+  ,layimAssetsPath: '../../layim-assets/' //layim 资源文件所在目录
+}).extend({
+  layim: layui.cache.layimPath + 'layim' //配置 layim 组件所在的路径
+}).use(['layim', 'laypage'], function(){
+  var layim = layui.layim
+  ,layer = layui.layer
+  ,laytpl = layui.laytpl
+  ,$ = layui.jquery
+  ,laypage = layui.laypage;
+  
+  //一些添加好友请求之类的交互参见文档
+  
+});
+</script>
+</body>
+</html>

+ 72 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/html/getmsg.json

@@ -0,0 +1,72 @@
+{
+    "code": 0,
+    "pages": 1,
+    "data": [
+        {
+            "id": 76,
+            "content": "申请添加你为好友",
+            "uid": 168,
+            "from": 166488,
+            "from_group": 0,
+            "type": 1,
+            "remark": "test1",
+            "href": null,
+            "read": 1,
+            "time": "刚刚",
+            "user": {
+                "id": 166488,
+                "avatar": "http://q.qlogo.cn/qqapp/101235792/B704597964F9BD0DB648292D1B09F7E8/100",
+                "username": "测试111",
+                "sign": null
+            }
+        },
+        {
+            "id": 75,
+            "content": "申请添加你为好友",
+            "uid": 168,
+            "from": 347592,
+            "from_group": 0,
+            "type": 1,
+            "remark": "test2",
+            "href": null,
+            "read": 1,
+            "time": "刚刚",
+            "user": {
+                "id": 347592,
+                "avatar": "http://q.qlogo.cn/qqapp/101235792/B78751375E0531675B1272AD994BA875/100",
+                "username": "测试222",
+                "sign": null
+            }
+        },
+        {
+            "id": 62,
+            "content": "测试333 拒绝了你的好友申请",
+            "uid": 168,
+            "from": null,
+            "from_group": null,
+            "type": 1,
+            "remark": null,
+            "href": null,
+            "read": 1,
+            "time": "10天前",
+            "user": {
+                "id": null
+            }
+        },
+        {
+            "id": 60,
+            "content": "测试666 已经同意你的好友申请",
+            "uid": 168,
+            "from": null,
+            "from_group": null,
+            "type": 1,
+            "remark": null,
+            "href": null,
+            "read": 1,
+            "time": "10天前",
+            "user": {
+                "id": null
+            }
+        }
+    ]
+}

+ 218 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/html/msgbox.html

@@ -0,0 +1,218 @@
+ 
+ 
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+<title>消息盒子</title>
+
+<link rel="stylesheet" href="//unpkg.com/layui/dist/css/layui.css">
+<style>
+.layim-msgbox{margin: 15px;}
+.layim-msgbox li{position: relative; margin-bottom: 10px; padding: 0 130px 10px 60px; padding-bottom: 10px; line-height: 22px; border-bottom: 1px dotted #e2e2e2;}
+.layim-msgbox .layim-msgbox-tips{margin: 0; padding: 10px 0; border: none; text-align: center; color: #999;}
+.layim-msgbox .layim-msgbox-system{padding: 0 10px 10px 10px;}
+.layim-msgbox li p span{padding-left: 5px; color: #999;}
+.layim-msgbox li p em{font-style: normal; color: #FF5722;}
+
+.layim-msgbox-avatar{position: absolute; left: 0; top: 0; width: 50px; height: 50px;}
+.layim-msgbox-user{padding-top: 5px;}
+.layim-msgbox-content{margin-top: 3px;}
+.layim-msgbox .layui-btn-small{padding: 0 15px; margin-left: 5px;}
+.layim-msgbox-btn{position: absolute; right: 0; top: 12px; color: #999;}
+</style>
+</head>
+<body>
+
+<ul class="layim-msgbox" id="LAY_view"></ul>
+
+<div style="margin: 0 15px;">
+  <blockquote class="layui-elem-quote">注意:这些都是模拟数据,实际使用时,需将其中的模拟接口改为你的项目真实接口。
+  <br>该模版文件所在目录(相对于 layim.js):/html/msgbox.html</blockquote>
+</div>
+
+<textarea title="消息模版" id="LAY_tpl" style="display:none;">
+{{# layui.each(d.data, function(index, item){
+  if(item.from){ }}
+    <li data-uid="{{ item.from }}" data-fromGroup="{{ item.from_group }}">
+      <a href="/u/{{ item.from }}/" target="_blank">
+        <img src="{{ item.user.avatar }}" class="layui-circle layim-msgbox-avatar">
+      </a>
+      <p class="layim-msgbox-user">
+        <a href="/u/{{ item.from }}/" target="_blank">{{ item.user.username||'' }}</a>
+        <span>{{ item.time }}</span>
+      </p>
+      <p class="layim-msgbox-content">
+        {{ item.content }} 
+        <span>{{ item.remark ? '附言: '+item.remark : '' }}</span>
+      </p>
+      <p class="layim-msgbox-btn">
+        <button class="layui-btn layui-btn-small" data-type="agree">同意</button>
+        <button class="layui-btn layui-btn-small layui-btn-primary" data-type="refuse">拒绝</button>
+      </p>
+    </li>
+  {{# } else { }}
+    <li class="layim-msgbox-system">
+      <p><em>系统:</em>{{ item.content }}<span>{{ item.time }}</span></p>
+    </li>
+  {{# }
+}); }}
+</textarea>
+
+<!-- 
+上述模版采用了 laytpl 语法
+-->
+
+
+<script src="//unpkg.com/layui/dist/layui.js"></script>
+<script>
+layui.config({
+  layimPath: '../../' //配置 layim.js 所在目录
+  ,layimAssetsPath: '../../layim-assets/' //layim 资源文件所在目录
+}).extend({
+  layim: layui.cache.layimPath + 'layim' //配置 layim 组件所在的路径
+}).use(['layim', 'flow'], function(){
+  var layim = layui.layim
+  ,layer = layui.layer
+  ,laytpl = layui.laytpl
+  ,$ = layui.jquery
+  ,flow = layui.flow;
+
+  var cache = {}; //用于临时记录请求到的数据
+
+  //请求消息
+  var renderMsg = function(page, callback){
+    
+    //实际部署时,请将下述 getmsg.json 改为你的接口地址
+    
+    $.get('getmsg.json', {
+      page: page || 1
+    }, function(res){
+      if(res.code != 0){
+        return layer.msg(res.msg);
+      }
+
+      //记录来源用户信息
+      layui.each(res.data, function(index, item){
+        cache[item.from] = item.user;
+      });
+
+      callback && callback(res.data, res.pages);
+    });
+  };
+
+  //消息信息流
+  flow.load({
+    elem: '#LAY_view' //流加载容器
+    ,isAuto: false
+    ,end: '<li class="layim-msgbox-tips">暂无更多新消息</li>'
+    ,done: function(page, next){ //加载下一页
+      renderMsg(page, function(data, pages){
+        var html = laytpl(LAY_tpl.value).render({
+          data: data
+          ,page: page
+        });
+        next(html, page < pages);
+      });
+    }
+  });
+
+  //打开页面即把消息标记为已读
+  /*
+  $.post('/message/read', {
+    type: 1
+  });
+  */
+
+  //操作
+  var active = {
+    //同意
+    agree: function(othis){
+      var li = othis.parents('li')
+      ,uid = li.data('uid')
+      ,from_group = li.data('fromGroup')
+      ,user = cache[uid];
+
+      //选择分组
+      parent.layui.layim.setFriendGroup({
+        type: 'friend'
+        ,username: user.username
+        ,avatar: user.avatar
+        ,group: parent.layui.layim.cache().friend //获取好友分组数据
+        ,submit: function(group, index){
+          
+          //将好友追加到主面板
+          parent.layui.layim.addList({
+            type: 'friend'
+            ,avatar: user.avatar //好友头像
+            ,username: user.username //好友昵称
+            ,groupid: group //所在的分组id
+            ,id: uid //好友ID
+            ,sign: user.sign //好友签名
+          });
+          parent.layer.close(index);
+          othis.parent().html('已同意');
+        
+        
+          //实际部署时,请开启下述注释,并改成你的接口地址
+          /*
+          $.post('/im/agreeFriend', {
+            uid: uid //对方用户ID
+            ,from_group: from_group //对方设定的好友分组
+            ,group: group //我设定的好友分组
+          }, function(res){
+            if(res.code != 0){
+              return layer.msg(res.msg);
+            }
+
+            //将好友追加到主面板
+            parent.layui.layim.addList({
+              type: 'friend'
+              ,avatar: user.avatar //好友头像
+              ,username: user.username //好友昵称
+              ,groupid: group //所在的分组id
+              ,id: uid //好友ID
+              ,sign: user.sign //好友签名
+            });
+            parent.layer.close(index);
+            othis.parent().html('已同意');
+          });
+          */
+          
+        }
+      });
+    }
+
+    //拒绝
+    ,refuse: function(othis){
+      var li = othis.parents('li')
+      ,uid = li.data('uid');
+
+      layer.confirm('确定拒绝吗?', function(index){
+        layer.close(index);
+        othis.parent().html('<em>已拒绝</em>');
+        
+        /*
+        $.post('/im/refuseFriend', {
+          uid: uid //对方用户ID
+        }, function(res){
+          if(res.code != 0){
+            return layer.msg(res.msg);
+          }
+          layer.close(index);
+          othis.parent().html('<em>已拒绝</em>');
+        });
+        */
+      });
+    }
+  };
+
+  $('body').on('click', '.layui-btn', function(){
+    var othis = $(this), type = othis.data('type');
+    active[type] ? active[type].call(this, othis) : '';
+  });
+});
+</script>
+</body>
+</html>

BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/default.png


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/0.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/1.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/10.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/11.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/12.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/13.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/14.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/15.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/16.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/17.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/18.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/19.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/2.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/20.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/21.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/22.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/23.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/24.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/25.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/26.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/27.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/28.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/29.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/3.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/30.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/31.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/32.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/33.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/34.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/35.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/36.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/37.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/38.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/39.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/4.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/40.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/41.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/42.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/43.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/44.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/45.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/46.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/47.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/48.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/49.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/5.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/50.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/51.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/52.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/53.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/54.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/55.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/56.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/57.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/58.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/59.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/6.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/60.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/61.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/62.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/63.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/64.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/65.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/66.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/67.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/68.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/69.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/7.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/70.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/71.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/8.gif


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/images/face/9.gif


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/layim.css


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/lib/layer-mobile.js


+ 2 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/lib/layim-mobile-open.js

@@ -0,0 +1,2 @@
+/** WebIMUI-v3.9.8 */
+ ;layui.define(function(i){i("layim-mobile",layui.v)});

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/lib/layim-mobile.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/lib/zepto.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 0
src/main/resources/static/layui/modules/layim/dist/layim-assets/mobile.css


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/1.jpg


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/2.jpg


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/3.jpg


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/4.jpg


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/skin/5.jpg


BIN
src/main/resources/static/layui/modules/layim/dist/layim-assets/voice/default.mp3


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 0
src/main/resources/static/layui/modules/layim/dist/layim.js


+ 90 - 0
src/main/resources/templates/chatgpt.html

@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>chatGPT</title>
+    <link rel="stylesheet" href="./layui/css/layui.css" media="all">
+    <script type="text/javascript" src="./layui/layui.js"></script>
+</head>
+<body>
+<div style="margin: 50px 0px 0px 50px">
+    <form class="layui-form layui-form-pane" action="">
+        <div class="layui-form-item">
+            <label class="layui-form-label" style="width: 16%">prompt</label>
+            <div class="layui-input-inline" style="width: 76%">
+                <input id="prompt" type="text" name="prompt" autocomplete="off" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-hide">
+            <label class="layui-form-label" style="width: 16%">max_tokens</label>
+            <div class="layui-input-inline" style="width: 76%">
+                <input id="max_tokens" type="text" name="max_tokens" autocomplete="off" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-hide">
+            <label class="layui-form-label" style="width: 16%">model</label>
+            <div class="layui-input-inline" style="width: 76%">
+                <input id="model" type="text" name="model" autocomplete="off" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <div class="layui-input-inline">
+                <button class="layui-btn" lay-submit lay-filter="preAddElement">立即提交</button>
+                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
+            </div>
+        </div>
+    </form>
+</div>
+</body>
+<script>
+
+    // 自定义模块,这里只需要开放soulTable即可
+    layui.config({
+        base: '/layui/modules/'   // 第三方模块所在目录
+        , layimAssetsPath: '../layui/modules/layim/dist/layim-assets/'
+        , version: 'v1.6.4' // 插件版本号
+    }).extend({
+        layim: 'layim/dist/layim'
+    });
+
+    layui.use(['form', 'layer', 'layim'], function () {
+        const form = layui.form
+            , layim = layui.layim
+            , $ = layui.$;
+
+        //提交
+        form.on('submit(preAddElement)', function (data) {
+            data.field.max_tokens = 2048
+            data.field.model = "text-davinci-003"
+            $.ajax({
+                type: 'post',
+                url: 'https://api.openai.com/v1/completions',
+                headers: {
+                    "Content-Type": "application/json",
+                    "Authorization": "Bearer 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"
+                },
+                dataType: 'json',
+                data: JSON.stringify(data.field),
+                success: function (res) {
+                    console.log(res)
+                },
+                error: function (errMsg) {
+                    console.log(errMsg);
+                }
+            })
+            return false;
+        });
+
+        layim.config({
+            brief: true //是否简约模式(如果true则不显示主面板)
+        }).chat({
+            name: '一个新窗口'
+            ,type: 'friend'
+            ,avatar: 'http://tp1.sinaimg.cn/5619439268/180/40030060651/1'
+            ,id: -2
+        });
+
+    });
+
+</script>
+</html>

+ 10 - 0
src/main/resources/templates/index.html

@@ -147,6 +147,7 @@
             <script type="text/html" id="toolbar">
                 <a class="layui-btn layui-btn-sm" lay-event="clearFilter">清除所有筛选条件</a>
                 <a class="layui-btn layui-btn-sm" lay-event="addElement">添加</a>
+                <a class="layui-btn layui-btn-sm" lay-event="chatGPT">添加</a>
             </script>
             <script type="text/html" id="elementTypeTpl">
                 {{# if(d.elementType === 0){ }}
@@ -358,6 +359,15 @@
                         iframe.child(pageID);
                     }
                 });
+            } else if (obj.event === 'chatGPT') {
+                layer.open({
+                    type: 2,
+                    area: ['900px', '1000px'],
+                    fixed: false, //不固定
+                    maxmin: true,
+                    resizing: false,
+                    content: 'chatGPT'
+                });
             }
         });
     });

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott