diff --git a/src/lang/en.ts b/src/lang/en.ts
index dcc22377..b4cf26f2 100644
--- a/src/lang/en.ts
+++ b/src/lang/en.ts
@@ -1062,4 +1062,6 @@ export const languageEnglish = {
thinkingTokens: "Thinking Tokens",
antiServerOverload: "Anti-Server Overload",
localActivationInGlobalLorebook: "Local Activation in Global Lorebook",
+ cachePoint: "Cache Point",
+ all: "All",
}
diff --git a/src/lang/ko.ts b/src/lang/ko.ts
index fec8ec0c..ed08f5e9 100644
--- a/src/lang/ko.ts
+++ b/src/lang/ko.ts
@@ -979,5 +979,7 @@ export const languageKorean = {
"paste": "붙여넣기",
"depth": "깊이",
"alwaysActiveInChat": "언제나 활성화 (현재 챗)",
- "childLoreDesc": "이것은 캐릭터 로어의 복사본이며, 삭제하거나 원본 로어에서 직접 비활성화하기 전에는 '언제나 활성화' 상태로 유지됩니다."
+ "childLoreDesc": "이것은 캐릭터 로어의 복사본이며, 삭제하거나 원본 로어에서 직접 비활성화하기 전에는 '언제나 활성화' 상태로 유지됩니다.",
+ "cachePoint": "캐시 포인트",
+ "all": "모두",
}
diff --git a/src/lib/UI/PromptDataItem.svelte b/src/lib/UI/PromptDataItem.svelte
index 1c65920c..25172c5f 100644
--- a/src/lib/UI/PromptDataItem.svelte
+++ b/src/lib/UI/PromptDataItem.svelte
@@ -183,6 +183,10 @@
promptItem.text = ""
promptItem.role = "system"
}
+ if(promptItem.type === 'cache'){
+ promptItem.depth = 1
+ promptItem.role = 'all'
+ }
if(promptItem.type === 'chat'){
promptItem.rangeStart = -1000
promptItem.rangeEnd = 'end'
@@ -198,6 +202,7 @@
{language.formating.memory}
{language.formating.postEverything}
{"chatML"}
+ {language.cachePoint}
{#if DBState.db.promptSettings.customChainOfThought}
{language.cot}
@@ -224,6 +229,17 @@
{language.prompt}
{/if}
+ {#if promptItem.type === 'cache'}
+ {language.depth}
+
+ {language.role}
+
+ {language.all}
+ {language.user}
+ {language.character}
+ {language.systemPrompt}
+
+ {/if}
{#if promptItem.type === 'chat'}
{#if promptItem.rangeStart !== -1000}
{language.rangeStart}
diff --git a/src/ts/process/index.svelte.ts b/src/ts/process/index.svelte.ts
index 7ec06c09..c8cc00cd 100644
--- a/src/ts/process/index.svelte.ts
+++ b/src/ts/process/index.svelte.ts
@@ -40,6 +40,7 @@ export interface OpenAIChat{
attr?:string[]
multimodals?: MultiModal[]
thoughts?: string[]
+ cachePoint?: boolean
}
export interface MultiModal{
@@ -635,6 +636,9 @@ export async function sendChat(chatProcessIndex = -1,arg:{
supaMemoryCardUsed = true
break
}
+ case 'cache':{
+ break
+ }
}
}
}
@@ -1142,6 +1146,22 @@ export async function sendChat(chatProcessIndex = -1,arg:{
}
pushPrompts(pmt)
+ break
+ }
+ case 'cache':{
+ let pointer = formated.length - 1
+ let depthRemaining = card.depth
+ while(pointer >= 0){
+ if(depthRemaining === 0){
+ break
+ }
+ if(formated[pointer].role === card.role || card.role === 'all'){
+ formated[pointer].cachePoint = true
+ depthRemaining--
+ }
+ }
+
+ break
}
}
}
diff --git a/src/ts/process/prompt.ts b/src/ts/process/prompt.ts
index 89c49dd2..f33e56c6 100644
--- a/src/ts/process/prompt.ts
+++ b/src/ts/process/prompt.ts
@@ -4,7 +4,7 @@ import { getDatabase, presetTemplate, setDatabase, type Database } from "../stor
import { alertError, alertNormal } from "../alert";
import type { OobaChatCompletionRequestParams } from "../model/ooba";
-export type PromptItem = PromptItemPlain|PromptItemTyped|PromptItemChat|PromptItemAuthorNote|PromptItemChatML
+export type PromptItem = PromptItemPlain|PromptItemTyped|PromptItemChat|PromptItemAuthorNote|PromptItemChatML|PromptItemCache
export type PromptType = PromptItem['type'];
export type PromptSettings = {
assistantPrefill: string
@@ -52,6 +52,14 @@ export interface PromptItemChat {
name?: string
}
+export interface PromptItemCache {
+ type: 'cache';
+ name: string
+ depth: number
+ role: 'user'|'assistant'|'system'|'all'
+
+}
+
export async function tokenizePreset(prompts:PromptItem[], consti:boolean = false){
let total = 0
for(const prompt of prompts){
diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts
index d10a7fd5..8521a346 100644
--- a/src/ts/process/request.ts
+++ b/src/ts/process/request.ts
@@ -370,6 +370,7 @@ export interface OpenAIChatExtra {
thoughts?:string[]
prefix?:boolean
reasoning_content?:string
+ cachePoint?:boolean
}
function reformater(formated:OpenAIChat[],modelInfo:LLMModel){
@@ -570,6 +571,7 @@ async function requestOpenAI(arg:RequestDataArgumentExtended):Promise {
if(claudeChat.length > 0 && claudeChat[claudeChat.length-1].role === chat.role){
let content = claudeChat[claudeChat.length-1].content
@@ -2533,6 +2536,11 @@ async function requestClaude(arg:RequestDataArgumentExtended):Promise