-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
161 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,49 @@ | ||
|
||
.conversationsListContainer{ | ||
.conversationsListContainer { | ||
margin-top: 10px; | ||
} | ||
|
||
.openConversationButton { | ||
display: block; /* Устанавливаем блочный тип элемента */ | ||
padding: 10px; /* Подберите подходящий отступ */ | ||
margin-bottom: 10px; /* Добавляем отступ между кнопками */ | ||
width: 100%; | ||
background-color: var(--vscode-dropdown-background); /* Цвет фона кнопки */ | ||
color: var(--vscode-button-foreground); /* Цвет текста кнопки */ | ||
border: none; /* Убираем границу кнопки */ | ||
border-radius: 5px; /* Задаем скругление углов */ | ||
cursor: pointer; /* Указатель при наведении */ | ||
--border-intensity: 0; /* Интенсивность подсветки границы */ | ||
--border-color: rgba(255, 255, 255, var(--border-intensity)); /* Цвет границы */ | ||
display: block; | ||
padding: 10px; | ||
margin-bottom: 10px; | ||
width: 100%; | ||
background-color: var(--vscode-dropdown-background); | ||
transition: background-color 0.2s; | ||
color: var(--vscode-button-foreground); | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
box-shadow: 0 0 0 0 none; | ||
transition: background-color 0.4s, box-shadow 0.4s, padding 0.2s, height 0.4s, max-height 0.4s; | ||
} | ||
|
||
.openConversationButton:hover { | ||
background-color: var(--vscode-button-hoverBackground); | ||
/* border-color: var(--border-color); */ | ||
background-color: var(--vscode-button-hoverBackground); | ||
box-shadow: 0 0 2em 0.2em var(--vscode-button-hoverBackground); | ||
padding: 15px; | ||
max-height: 20vh; | ||
} | ||
|
||
.openConversationButton:hover .openConversationButtonTopText, | ||
.openConversationButton:hover .openConversationButtonBottomText { | ||
display: -webkit-box; | ||
-webkit-box-orient: vertical; | ||
-webkit-line-clamp: 4; | ||
overflow: hidden; | ||
white-space: normal; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.openConversationButton .openConversationButtonTopText, .openConversationButton .openConversationButtonBottomText { | ||
display: block; | ||
white-space: nowrap; /* Позволяем перенос строк */ | ||
overflow: hidden; /* Отменяем обрезание текста */ | ||
text-overflow: ellipsis; /* Убираем эффект многоточия для каждой строки */ | ||
text-align: left; /* Выравнивание текста по левому краю */ | ||
.openConversationButton .openConversationButtonTopText, | ||
.openConversationButton .openConversationButtonBottomText { | ||
display: block; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
text-align: left; | ||
} | ||
|
||
.openConversationButton .openConversationButtonBottomText { | ||
font-size: var(--vscode-editor-font-size, 14px) - 2px; /* Меньший размер шрифта для второй строки */ | ||
color: var(--vscode-textPreformat-foreground); /* Цвет текста кнопки */ | ||
font-size: var(--vscode-editor-font-size, 14px) - 2px; | ||
color: var(--vscode-textPreformat-foreground); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* Стили для сообщений, отправленных пользователем */ | ||
.userMargin { | ||
margin-left: auto!important; | ||
background-color: var(--vscode-dropdown-background); | ||
color: var(--vscode-button-foreground); | ||
border-right: 2px solid var(--vscode-focusBorder)!important; | ||
} | ||
|
||
/* Стили для сообщений, полученных от других */ | ||
.nonuserMargin { | ||
margin-right: auto!important; | ||
background-color: var(--vscode-dropdown-background); | ||
color: var(--vscode-button-foreground); | ||
border-left: 2px solid var(--vscode-focusBorder)!important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,57 @@ | ||
|
||
|
||
function clickToOpenConversationButton(chatData){ | ||
function clickToOpenConversationButton(chatData) { | ||
IN_CHAT = true; | ||
CURRENT_CHAT_ID = chatData.id; | ||
// console.log(chatData); | ||
createConversationBody(chatData); | ||
} | ||
|
||
|
||
// eslint-disable-next-line no-unused-vars | ||
function createOpenConversationButton(chatData){ | ||
function createOpenConversationButton(chatData) { | ||
let openConversationButton = document.createElement('button'); | ||
openConversationButton.className = 'openConversationButton'; | ||
|
||
if (chatData.conversation.length == 0 || chatData.conversation[chatData.conversation.length-1].role == "user") { | ||
openConversationButton.className = "openConversationButton userMargin"; | ||
} else { | ||
openConversationButton.className = "openConversationButton nonuserMargin"; | ||
} | ||
let openConversationButtonTopText = document.createElement('span'); | ||
if (chatData.conversation.length>0){ | ||
openConversationButtonTopText.textContent = chatData.conversation[chatData.conversation.length-1].content; | ||
}else{ | ||
if (chatData.conversation.length > 0) { | ||
openConversationButtonTopText.textContent = chatData.conversation[chatData.conversation.length - 1].content; | ||
} else { | ||
openConversationButtonTopText.textContent = "Empty chat"; | ||
} | ||
openConversationButtonTopText.className = 'openConversationButtonTopText'; | ||
openConversationButton.appendChild(openConversationButtonTopText); | ||
openConversationButtonTopText.className = 'openConversationButtonTopText'; | ||
openConversationButton.appendChild(openConversationButtonTopText); | ||
|
||
openConversationButton.appendChild(document.createElement('br')); | ||
openConversationButton.appendChild(document.createElement('br')); | ||
|
||
let openConversationButtonBottomText = document.createElement('span'); | ||
openConversationButtonBottomText.textContent = chatData.model; | ||
openConversationButtonBottomText.className = 'openConversationButtonBottomText'; | ||
openConversationButton.appendChild(openConversationButtonBottomText); | ||
let openConversationButtonBottomText = document.createElement('span'); | ||
openConversationButtonBottomText.textContent = chatData.model; | ||
openConversationButtonBottomText.className = 'openConversationButtonBottomText'; | ||
openConversationButton.appendChild(openConversationButtonBottomText); | ||
|
||
openConversationButton.addEventListener('click', function() { | ||
openConversationButton.addEventListener('click', function () { | ||
clickToOpenConversationButton(chatData); | ||
}); | ||
// openConversationButton.addEventListener('mousemove', function(e) { | ||
// const rect = e.target.getBoundingClientRect(); | ||
// const x = e.clientX - rect.left; // X координата относительно кнопки | ||
// const y = e.clientY - rect.top; // Y координата относительно кнопки | ||
// const centerX = rect.width / 2; | ||
// const centerY = rect.height / 2; | ||
// const distance = Math.sqrt((x - centerX) ** 2 + (y - centerY) ** 2); | ||
// const maxDistance = Math.sqrt(centerX ** 2 + centerY ** 2); // Максимальное расстояние от центра до угла | ||
// const intensity = 1 - Math.min(distance / maxDistance, 1); // Интенсивность от 0 до 1 | ||
// openConversationButton.style.setProperty('--border-intensity', intensity.toFixed(2)); | ||
// }); | ||
|
||
// // Возвращаем нормальный стиль когда курсор уходит с кнопки | ||
// openConversationButton.addEventListener('mouseleave', function() { | ||
// openConversationButton.style.setProperty('--border-intensity', 0); | ||
// }); | ||
return openConversationButton; | ||
} | ||
|
||
|
||
// eslint-disable-next-line no-unused-vars | ||
function updateConversationsList(chatsListData) { | ||
let bodyElement = document.getElementById('body'); | ||
let bodyElement = document.getElementById('body'); | ||
|
||
bodyElement.innerHTML = ''; | ||
bodyElement.innerHTML = ''; | ||
|
||
let conversationsListContainer = document.createElement('div'); | ||
conversationsListContainer.id = 'conversationsListContainer'; | ||
conversationsListContainer.className = 'conversationsListContainer'; | ||
|
||
chatsListData.forEach(function(chat) { | ||
chatsListData.forEach(function (chat) { | ||
let button = createOpenConversationButton(chat); | ||
conversationsListContainer.appendChild(button); | ||
}); | ||
conversationsListContainer.appendChild(button); | ||
}); | ||
|
||
bodyElement.appendChild(conversationsListContainer); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.