Show chat completion source on hover

This commit is contained in:
Cohee 2023-08-16 13:51:38 +03:00
parent e85e1b2cb7
commit 7a204bef05
1 changed files with 13 additions and 4 deletions

View File

@ -4021,7 +4021,7 @@ function saveReply(type, getMessage, this_mes_is_name, title) {
chat[chat.length - 1]['gen_started'] = generation_started;
chat[chat.length - 1]['gen_finished'] = generationFinished;
chat[chat.length - 1]['send_date'] = getMessageTimeStamp();
chat[chat.length - 1]['extra']['api'] = main_api;
chat[chat.length - 1]['extra']['api'] = getGeneratingApi();
chat[chat.length - 1]['extra']['model'] = getGeneratingModel();
addOneMessage(chat[chat.length - 1], { type: 'swipe' });
} else {
@ -4035,7 +4035,7 @@ function saveReply(type, getMessage, this_mes_is_name, title) {
chat[chat.length - 1]['gen_started'] = generation_started;
chat[chat.length - 1]['gen_finished'] = generationFinished;
chat[chat.length - 1]['send_date'] = getMessageTimeStamp();
chat[chat.length - 1]["extra"]["api"] = main_api;
chat[chat.length - 1]["extra"]["api"] = getGeneratingApi();
chat[chat.length - 1]["extra"]["model"] = getGeneratingModel();
addOneMessage(chat[chat.length - 1], { type: 'swipe' });
} else if (type === 'appendFinal') {
@ -4046,7 +4046,7 @@ function saveReply(type, getMessage, this_mes_is_name, title) {
chat[chat.length - 1]['gen_started'] = generation_started;
chat[chat.length - 1]['gen_finished'] = generationFinished;
chat[chat.length - 1]['send_date'] = getMessageTimeStamp();
chat[chat.length - 1]["extra"]["api"] = main_api;
chat[chat.length - 1]["extra"]["api"] = getGeneratingApi();
chat[chat.length - 1]["extra"]["model"] = getGeneratingModel();
addOneMessage(chat[chat.length - 1], { type: 'swipe' });
@ -4058,7 +4058,7 @@ function saveReply(type, getMessage, this_mes_is_name, title) {
chat[chat.length - 1]['is_user'] = false;
chat[chat.length - 1]['is_name'] = this_mes_is_name;
chat[chat.length - 1]['send_date'] = getMessageTimeStamp();
chat[chat.length - 1]["extra"]["api"] = main_api;
chat[chat.length - 1]["extra"]["api"] = getGeneratingApi();
chat[chat.length - 1]["extra"]["model"] = getGeneratingModel();
if (power_user.trim_spaces) {
getMessage = getMessage.trim();
@ -4121,6 +4121,15 @@ function saveImageToMessage(img, mes) {
}
}
function getGeneratingApi() {
switch (main_api) {
case 'openai':
return oai_settings.chat_completion_source || 'openai';
default:
return main_api;
}
}
function getGeneratingModel(mes) {
let model = '';
switch (main_api) {