Change the model cache to local storage and support caching multiple models

This commit is contained in:
Rafi
2023-02-12 12:40:47 +08:00
parent 2f2ed46911
commit edde4112c1
7 changed files with 179 additions and 55 deletions

11
app.vue
View File

@@ -1,8 +1,8 @@
<script setup>
import { fetchEventSource } from '@microsoft/fetch-event-source'
import ApiKeyEditor from "./components/ApiKeyEditor";
const runtimeConfig = useRuntimeConfig()
const currentModel = useCurrentModel()
const fetchingResponse = ref(false)
const fetchReply = async (message, parentMessageId) => {
const ctrl = new AbortController()
@@ -14,6 +14,7 @@ const fetchReply = async (message, parentMessageId) => {
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: currentModel.value,
message: message,
parentMessageId: parentMessageId,
conversationId: currentConversation.value.id
@@ -114,18 +115,18 @@ onNuxtReady(() => {
:theme="theme"
>
<v-navigation-drawer
theme="dark"
permanent
>
<v-list>
<ModelNameEditor/>
<ApiKeyEditor/>
<ClientOnly>
<ModelDialog/>
</ClientOnly>
</v-list>
<template v-slot:append>
<v-divider></v-divider>
<v-list>
<!-- <v-list-item title="Clear conversations"></v-list-item>-->
<ApiKeyEditor/>
<v-list-item
:prepend-icon="theme === 'light' ? 'dark_mode' : 'light_mode'"
:title="(theme === 'light' ? 'Dark' : 'Light') + ' mode'"