总结群聊.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // ==UserScript==
  2. // @name 自动总结群聊
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description for cyclekiller/chatsum
  6. // @author lyyyyy
  7. // @match http://127.0.0.1:17860/
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=0.1
  9. // @run-at document-idle
  10. // @grant none
  11. // ==/UserScript==
  12. //wenda_auto_default_disabled 这行代码将使本auto默认不启用
  13. app.buttons.push({
  14. icon: "account-group",
  15. click: async () => {
  16. lsdh(false)
  17. let s = await f_自动总结群聊_打开()
  18. paragraphs = s.replace(/[\r\n]+/g, "\n")
  19. send(`raw!Instruction: 下面是qq群“ChatRWKV技术研发群”的一段聊天记录节选,“[捂脸]”这种格式表示qq表情,“@某人”这种格式表示对某人说。注意不同的发言之间可能存在交错。请总结这段聊天记录的主要内容。
  20. Input: ${paragraphs}
  21. Response: 这段聊天记录的主要内容是`)
  22. //
  23. },
  24. color: () => app.color,
  25. description: "自动总结群聊"
  26. })
  27. f_自动总结群聊_打开 = async () => {
  28. let contents = ''
  29. await new Promise(resolve => {
  30. let input = document.createElement('input')
  31. input.type = 'file'
  32. input.accept = '.txt'
  33. input.onchange = function () {
  34. var file = input.files[0];
  35. var reader = new FileReader();
  36. reader.onload = function (e) {
  37. contents = e.target.result;
  38. resolve()
  39. };
  40. reader.readAsText(file);
  41. }
  42. input.click()
  43. })
  44. return contents
  45. }
粤ICP备19079148号