Update formatInfo.ts (#569)
parent
9862d69557
commit
aa1504b129
|
|
@ -1,10 +1,26 @@
|
|||
import { parseFromRawInfo } from '@bluelovers/auto1111-pnginfo';
|
||||
|
||||
import { Converter } from '@/scripts/formatPrompt';
|
||||
import { splitSmartly } from 'split-smartly2';
|
||||
|
||||
const formatPrompt = (prompt: string) => {
|
||||
let newPrompt = prompt.replaceAll('<', '<').replaceAll('>', '>');
|
||||
return Converter.convert(newPrompt);
|
||||
let newPrompt = prompt
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replace(/^[\x00\s,,。]+$/gm, '')
|
||||
.replace(/\n{2,}/g, '\n')
|
||||
;
|
||||
|
||||
const entries = splitSmartly(newPrompt.replace(/\n/g, '<br>'), [',',',','。'], {
|
||||
brackets: true,
|
||||
trimSeparators: true,
|
||||
}) as string[];
|
||||
|
||||
return entries
|
||||
.filter(line => line.length)
|
||||
.join(', ')
|
||||
.replace(/<br>/g, '\n')
|
||||
.replace(/^\s+|\s+$/gm, '')
|
||||
;
|
||||
};
|
||||
|
||||
export const formatInfo = (info: string) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue