mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
CFG: Add per-character support
Adds per-character CFG as a drop-in replacement for global CFG. If the use character CFG checkbox isn't checked, the global one will be used. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
import { extension_settings } from "../../extensions.js"
|
||||
import { getCharaFilename } from "../../utils.js";
|
||||
|
||||
// TODO: Update to use per-chat and per-character CFG
|
||||
export function getCfg() {
|
||||
return {
|
||||
guidanceScale: extension_settings.cfg.global.guidance_scale,
|
||||
negativePrompt: extension_settings.cfg.global.negative_prompt
|
||||
const charaCfg = extension_settings.cfg.chara.find((e) => e.name === getCharaFilename());
|
||||
if (charaCfg && charaCfg?.useChara) {
|
||||
return {
|
||||
guidanceScale: charaCfg.guidance_scale ?? 1.00,
|
||||
negativePrompt: charaCfg.negative_prompt ?? ''
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
guidanceScale: extension_settings.cfg.global.guidance_scale ?? 1.00,
|
||||
negativePrompt: extension_settings.cfg.global.negative_prompt ?? ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user