🐛 fix: Fix lint error

main
canisminor1990 2024-05-24 23:34:48 +08:00
parent 2d33e854bd
commit 7f6dc8ada2
3 changed files with 77 additions and 80 deletions

File diff suppressed because one or more lines are too long

View File

@ -67,17 +67,17 @@
] ]
}, },
"dependencies": { "dependencies": {
"@bluelovers/auto1111-pnginfo": "^2.0.2", "@bluelovers/auto1111-pnginfo": "^2.0.3",
"@icons-pack/react-simple-icons": "^9.5.0", "@icons-pack/react-simple-icons": "^9.5.0",
"@lobehub/ui": "^1.138.25", "@lobehub/ui": "^1.141.0",
"@rollup/rollup-win32-x64-msvc": "^4.17.2", "@rollup/rollup-win32-x64-msvc": "^4.18.0",
"ahooks": "^3.7.11", "ahooks": "^3.8.0",
"antd": "5.17.0", "antd": "5.17.0",
"antd-style": "^3.6.2", "antd-style": "^3.6.2",
"consola": "^3.2.3", "consola": "^3.2.3",
"dayjs": "^1.11.11", "dayjs": "^1.11.11",
"i18next": "^23.11.4", "i18next": "^23.11.5",
"i18next-http-backend": "^2.5.1", "i18next-http-backend": "^2.5.2",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"lucide-react": "latest", "lucide-react": "latest",
"lucide-static": "latest", "lucide-static": "latest",
@ -88,12 +88,12 @@
"react-dnd-html5-backend": "^16.0.1", "react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"react-i18next": "^14.1.1", "react-i18next": "^14.1.2",
"react-layout-kit": "^1.9.0", "react-layout-kit": "^1.9.0",
"react-rnd": "^10.4.10", "react-rnd": "^10.4.10",
"react-tag-input": "^6.9.0", "react-tag-input": "6.9.0",
"semver": "^7.6.2", "semver": "^7.6.2",
"shiki": "^1.5.2", "shiki": "^1.6.0",
"split-smartly2": "^2.0.1", "split-smartly2": "^2.0.1",
"swr": "^2.2.5", "swr": "^2.2.5",
"url-join": "^5.0.0", "url-join": "^5.0.0",
@ -107,12 +107,12 @@
"@testing-library/react": "^15.0.7", "@testing-library/react": "^15.0.7",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^20.12.12", "@types/node": "^20.12.12",
"@types/react": "^18.3.2", "@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@types/react-helmet": "^6.1.11", "@types/react-helmet": "^6.1.11",
"@types/react-tag-input": "^6.6.6", "@types/react-tag-input": "^6.6.6",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@vitejs/plugin-react-swc": "^3.6.0", "@vitejs/plugin-react-swc": "^3.7.0",
"@vitest/coverage-v8": "^1.6.0", "@vitest/coverage-v8": "^1.6.0",
"commitlint": "^19.3.0", "commitlint": "^19.3.0",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
@ -120,7 +120,7 @@
"fast-deep-equal": "^3.1.3", "fast-deep-equal": "^3.1.3",
"husky": "^9.0.11", "husky": "^9.0.11",
"jsdom": "^24.0.0", "jsdom": "^24.0.0",
"lint-staged": "^15.2.2", "lint-staged": "^15.2.4",
"prettier": "^3.2.5", "prettier": "^3.2.5",
"query-string": "^9.0.0", "query-string": "^9.0.0",
"remark": "^14.0.3", "remark": "^14.0.3",

View File

@ -1,26 +1,23 @@
import { parseFromRawInfo } from '@bluelovers/auto1111-pnginfo'; import { parseFromRawInfo } from '@bluelovers/auto1111-pnginfo';
import { splitSmartly } from 'split-smartly2'; import { splitSmartly } from 'split-smartly2';
const formatPrompt = (prompt: string) => { const formatPrompt = (prompt: string) => {
let newPrompt = prompt let newPrompt = prompt
.replaceAll('&lt;', '<') .replaceAll('&lt;', '<')
.replaceAll('&gt;', '>') .replaceAll('&gt;', '>')
.replace(/^[\x00\s,,。]+$/gm, '') // eslint-disable-next-line no-control-regex
.replace(/\n{2,}/g, '\n') .replaceAll(/^[\s\u0000,。,]+$/gm, '')
; .replaceAll(/\n{2,}/g, '\n');
const entries = splitSmartly(newPrompt.replaceAll('\n', '<br>'), [',', '', '。'], {
const entries = splitSmartly(newPrompt.replace(/\n/g, '<br>'), [',','','。'], {
brackets: true, brackets: true,
trimSeparators: true, trimSeparators: true,
}) as string[]; }) as string[];
return entries return entries
.filter(line => line.length) .filter((line) => line.length)
.join(', ') .join(', ')
.replace(/<br>/g, '\n') .replaceAll('<br>', '\n')
.replace(/^\s+|\s+$/gm, '') .replaceAll(/^\s+|\s+$/gm, '');
;
}; };
export const formatInfo = (info: string) => { export const formatInfo = (info: string) => {