feat: Add custom toggles

This commit is contained in:
kwaroran
2024-05-27 11:18:15 +09:00
parent eb992a5c6b
commit 1d5a829f88
7 changed files with 62 additions and 6 deletions

View File

@@ -1,4 +1,6 @@
import { get } from "svelte/store";
import { tokenizeAccurate } from "../tokenizer";
import type { Database } from "../storage/database";
export type PromptItem = PromptItemPlain|PromptItemTyped|PromptItemChat|PromptItemAuthorNote;
export type PromptType = PromptItem['type'];
@@ -61,4 +63,21 @@ 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
}