Abandoning sqlite cache
This commit is contained in:
@@ -69,7 +69,6 @@ export default defineEventHandler(async (event) => {
|
||||
// This is used for storing conversations, and supports additional drivers (conversations are stored in memory by default)
|
||||
// For example, to use a JSON file (`npm i keyv-file`) as a database:
|
||||
// store: new KeyvFile({ filename: 'cache.json' }),
|
||||
uri: 'sqlite://database.sqlite'
|
||||
};
|
||||
|
||||
const chatGptClient = new ChatGPTClient(body.openaiApiKey, clientOptions, cacheOptions);
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import {getSetting, setSetting} from "~/utils/keyv";
|
||||
import {apiError, apiSuccess} from "~/utils/api";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const method = getMethod(event)
|
||||
if (method === 'GET') {
|
||||
const query = getQuery(event)
|
||||
let value = await getSetting(query.key)
|
||||
if (!value && query.key === 'modelName') {
|
||||
value = runtimeConfig.openaiModelName
|
||||
}
|
||||
return apiSuccess(value)
|
||||
} else if (method === 'POST') {
|
||||
const body = await readBody(event)
|
||||
await setSetting(body.key, body.value)
|
||||
return apiSuccess()
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user