Skip to content

Commit

Permalink
update js beautify
Browse files Browse the repository at this point in the history
  • Loading branch information
SchneeHertz committed Sep 5, 2023
1 parent 5880e5d commit f5507c4
Show file tree
Hide file tree
Showing 2 changed files with 366 additions and 15 deletions.
3 changes: 3 additions & 0 deletions modules/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const axios = require('axios')
const { convert } = require('html-to-text')
const { getQuickJS, shouldInterruptAfterDeadline } = require('quickjs-emscripten')
const { shell } = require('electron')
const { js: beautify } = require('js-beautify/js')

let { config: { proxyObject, proxyString, AI_NAME, writeFolder } } = require('../utils/loadConfig.js')

const { sliceStringbyTokenLength } = require('./tiktoken.js')
Expand Down Expand Up @@ -145,6 +147,7 @@ const functionAction = {
return `${AI_NAME}读取了 ${filePath}`
},
javaScriptInterpreter({ code }) {
code = beautify(code, { indent_size: 2 })
return `${AI_NAME}运行了\n\`\`\`javascript\n${code}\n\`\`\``
},
openLocalFileOrWebpage({ filePath, url, type }) {
Expand Down

0 comments on commit f5507c4

Please sign in to comment.