refactor: Move getCustomToggles to parseKeyValue
This commit is contained in:
@@ -64,20 +64,3 @@ export async function tokenizePreset(prompts:PromptItem[], consti:boolean = fals
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
export function getCustomToggles(template:string){
|
||||
if(!template){
|
||||
return []
|
||||
}
|
||||
|
||||
const keyValue:[string, string][] = []
|
||||
|
||||
for(const line of template.split('\n')){
|
||||
const [key, value] = line.split('=')
|
||||
if(key && value){
|
||||
keyValue.push([key, value])
|
||||
}
|
||||
}
|
||||
|
||||
return keyValue
|
||||
}
|
||||
@@ -967,4 +967,21 @@ export const isKnownUri = (uri:string) => {
|
||||
|| uri.startsWith('https://')
|
||||
|| uri.startsWith('ccdefault:')
|
||||
|| uri.startsWith('embeded://')
|
||||
}
|
||||
|
||||
export function parseKeyValue(template:string){
|
||||
if(!template){
|
||||
return []
|
||||
}
|
||||
|
||||
const keyValue:[string, string][] = []
|
||||
|
||||
for(const line of template.split('\n')){
|
||||
const [key, value] = line.split('=')
|
||||
if(key && value){
|
||||
keyValue.push([key, value])
|
||||
}
|
||||
}
|
||||
|
||||
return keyValue
|
||||
}
|
||||
Reference in New Issue
Block a user