Temporary agents and chats
This commit is contained in:
1 parent
fe596761dc
commit
e07f8ee05f
15 files changed
+447
-172
No files matched your search
@@ -59,11 +59,9 @@
|
||||
// === State Management === //
|
||||
|
||||
async function loadChatState (newId) {
|
||||
chatId = parseInt(newId);
|
||||
if (chatId == null || isNaN(chatId)) {
|
||||
console.error("Invalid chat id", chatId);
|
||||
return;
|
||||
}
|
||||
// This line was converting newId into an integer.
|
||||
// Some parts of the program may still rely on it.
|
||||
chatId = newId;
|
||||
|
||||
// Create an agent name dictionary
|
||||
const _agents = await backend.getAgents();
|
||||
@@ -307,7 +305,7 @@
|
||||
|
||||
async function startNewThread () {
|
||||
const res = await backend.sendAction("create-chat-thread", {chatId});
|
||||
console.log("Starting a new thread", res);
|
||||
console.log("Starting a nedeleteChatw thread", res);
|
||||
if (res.threadId != null) {
|
||||
currentThreadId.value = res.threadId;
|
||||
expandThread(res.threadId, true);
|
||||
@@ -325,6 +323,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteChat (chat) {
|
||||
if (!await ui.confirm(`Delete Chat ${chat.name} with id ${chat.id}`)) return;
|
||||
const res = await backend.sendAction("delete-chat", {chatId: chat.id});
|
||||
console.log("Chat Delete Output", res);
|
||||
}
|
||||
|
||||
async function renameChat (chat) {
|
||||
ui.alert("TODO: Rename Chats");
|
||||
}
|
||||
|
||||
|
||||
// === Special Chat Functions === //
|
||||
|
||||
@@ -418,6 +426,10 @@
|
||||
<main>
|
||||
<TitleBar>
|
||||
<h1>{{ chat.name || 'Chat #' + chat.id }}</h1>
|
||||
<div>
|
||||
<button @click="renameChat(chat)">Rename</button>
|
||||
<button @click="deleteChat(chat)">Delete</button>
|
||||
</div>
|
||||
</TitleBar>
|
||||
|
||||
<div class="messages-container" ref="chatContainerElem">
|
||||
|
||||
Reference in new issue
Block a user