feat: Add support for saving and restoring last used system prompt

This commit is contained in:
n4ze3m
2024-12-07 18:15:14 +05:30
parent d45b279348
commit bd08526935
5 changed files with 102 additions and 11 deletions

View File

@@ -125,4 +125,23 @@ export const setLastUsedChatModel = async (
await storage.set(`lastUsedChatModel-${historyId}`, model)
}
export const getLastUsedChatSystemPrompt = async (
historyId: string
): Promise<{ prompt_id?: string; prompt_content?: string } | undefined> => {
return await storage.get<{ prompt_id?: string; prompt_content?: string } | undefined>(
`lastUsedChatSystemPrompt-${historyId}`
)
}
export const setLastUsedChatSystemPrompt = async (
historyId: string,
prompt: {
prompt_id?: string
prompt_content?: string
}
): Promise<void> => {
await storage.set(`lastUsedChatSystemPrompt-${historyId}`, prompt)
}
export { getAllModelSettings, setModelSetting }