Support configuring model parameters in the front-end and storing them in localStorage.

This commit is contained in:
Rafi
2023-03-17 17:01:18 +08:00
parent 1f3a025918
commit 878fda0054
7 changed files with 234 additions and 20 deletions

View File

@@ -51,6 +51,14 @@ const abortFetch = () => {
}
const fetchReply = async (message, parentMessageId) => {
ctrl = new AbortController()
const data = Object.assign({}, currentModel.value, {
openaiApiKey: openaiApiKey.value,
message: message,
parentMessageId: parentMessageId,
conversationId: currentConversation.value.id
})
try {
await fetchEventSource('/api/conversation/', {
signal: ctrl.signal,
@@ -59,13 +67,7 @@ const fetchReply = async (message, parentMessageId) => {
'accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: currentModel.value,
openaiApiKey: openaiApiKey.value,
message: message,
parentMessageId: parentMessageId,
conversationId: currentConversation.value.id
}),
body: JSON.stringify(data),
onopen(response) {
if (response.ok && response.headers.get('content-type') === EventStreamContentType) {
return;