|
|
@ -109,7 +109,7 @@ async function onConversation() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
let lastText = ''
|
|
|
|
let lastText = ''
|
|
|
|
const fetchChatAPIOnce = async () => {
|
|
|
|
const fetchChatAPIOnce = async () => {
|
|
|
|
await fetchChatAPIProcess<Chat.ConversationResponse>({
|
|
|
|
const { data } = await fetchChatAPIProcess<Chat.ConversationResponse>({
|
|
|
|
prompt: message,
|
|
|
|
prompt: message,
|
|
|
|
options,
|
|
|
|
options,
|
|
|
|
signal: controller.signal,
|
|
|
|
signal: controller.signal,
|
|
|
@ -131,7 +131,7 @@ async function onConversation() {
|
|
|
|
text: lastText + data.text ?? '',
|
|
|
|
text: lastText + data.text ?? '',
|
|
|
|
inversion: false,
|
|
|
|
inversion: false,
|
|
|
|
error: false,
|
|
|
|
error: false,
|
|
|
|
loading: false,
|
|
|
|
loading: true,
|
|
|
|
conversationOptions: { conversationId: data.conversationId, parentMessageId: data.id },
|
|
|
|
conversationOptions: { conversationId: data.conversationId, parentMessageId: data.id },
|
|
|
|
requestOptions: { prompt: message, options: { ...options } },
|
|
|
|
requestOptions: { prompt: message, options: { ...options } },
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -151,6 +151,19 @@ async function onConversation() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
updateChat(
|
|
|
|
|
|
|
|
+uuid,
|
|
|
|
|
|
|
|
dataSources.value.length - 1,
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dateTime: new Date().toLocaleString(),
|
|
|
|
|
|
|
|
text: lastText + data.text ?? '',
|
|
|
|
|
|
|
|
inversion: false,
|
|
|
|
|
|
|
|
error: false,
|
|
|
|
|
|
|
|
loading: false,
|
|
|
|
|
|
|
|
conversationOptions: { conversationId: data.conversationId, parentMessageId: data.id },
|
|
|
|
|
|
|
|
requestOptions: { prompt: message, options: { ...options } },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await fetchChatAPIOnce()
|
|
|
|
await fetchChatAPIOnce()
|
|
|
@ -239,7 +252,7 @@ async function onRegenerate(index: number) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
let lastText = ''
|
|
|
|
let lastText = ''
|
|
|
|
const fetchChatAPIOnce = async () => {
|
|
|
|
const fetchChatAPIOnce = async () => {
|
|
|
|
await fetchChatAPIProcess<Chat.ConversationResponse>({
|
|
|
|
const { data } = await fetchChatAPIProcess<Chat.ConversationResponse>({
|
|
|
|
prompt: message,
|
|
|
|
prompt: message,
|
|
|
|
options,
|
|
|
|
options,
|
|
|
|
signal: controller.signal,
|
|
|
|
signal: controller.signal,
|
|
|
@ -261,7 +274,7 @@ async function onRegenerate(index: number) {
|
|
|
|
text: lastText + data.text ?? '',
|
|
|
|
text: lastText + data.text ?? '',
|
|
|
|
inversion: false,
|
|
|
|
inversion: false,
|
|
|
|
error: false,
|
|
|
|
error: false,
|
|
|
|
loading: false,
|
|
|
|
loading: true,
|
|
|
|
conversationOptions: { conversationId: data.conversationId, parentMessageId: data.id },
|
|
|
|
conversationOptions: { conversationId: data.conversationId, parentMessageId: data.id },
|
|
|
|
requestOptions: { prompt: message, ...options },
|
|
|
|
requestOptions: { prompt: message, ...options },
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -279,6 +292,19 @@ async function onRegenerate(index: number) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
updateChat(
|
|
|
|
|
|
|
|
+uuid,
|
|
|
|
|
|
|
|
index,
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dateTime: new Date().toLocaleString(),
|
|
|
|
|
|
|
|
text: lastText + data.text ?? '',
|
|
|
|
|
|
|
|
inversion: false,
|
|
|
|
|
|
|
|
error: false,
|
|
|
|
|
|
|
|
loading: false,
|
|
|
|
|
|
|
|
conversationOptions: { conversationId: data.conversationId, parentMessageId: data.id },
|
|
|
|
|
|
|
|
requestOptions: { prompt: message, ...options },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await fetchChatAPIOnce()
|
|
|
|
await fetchChatAPIOnce()
|
|
|
|
}
|
|
|
|
}
|
|
|
|