C++ / fmt (pull_request) Failing after 6s
C++ / build (pull_request) Failing after 10s
C++ / clang-tidy (pull_request) Failing after 9s
JS/TS / fmt (pull_request) Successful in 10s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Successful in 30s
Rust / build (pull_request) Successful in 49s
Python / verify (pull_request) Successful in 1m35s
Rust / fmt (pull_request) Successful in 36s
Rust / clippy (pull_request) Successful in 54s
84 lines
1.4 KiB
QML
84 lines
1.4 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import ZShell.Config
|
|
import ZShell.Llm
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import Quickshell
|
|
import qs.Helpers
|
|
import qs.Modules.Notifications.Sidebar
|
|
import qs.Components
|
|
import qs.Services
|
|
|
|
Item {
|
|
id: root
|
|
|
|
anchors.fill: parent
|
|
anchors.margins: Tokens.padding.small
|
|
|
|
Component.onCompleted: {
|
|
if (ChatState.firstOpen) {
|
|
ChatState.openDraft();
|
|
stack.push(chatList);
|
|
stack.push(chatContent);
|
|
ChatState.firstOpen = false;
|
|
return;
|
|
}
|
|
|
|
if (ChatState.inChat) {
|
|
stack.push(chatList);
|
|
stack.push(chatContent);
|
|
} else
|
|
stack.push(chatList);
|
|
}
|
|
|
|
function openChat(): void {
|
|
if (stack.depth < 2)
|
|
stack.push(chatContent);
|
|
}
|
|
|
|
StackView {
|
|
id: stack
|
|
anchors.fill: parent
|
|
}
|
|
|
|
Component {
|
|
id: chatList
|
|
|
|
ChatList {
|
|
model: LlmClient.chats
|
|
|
|
onDeleteChatRequest: chat => {
|
|
const wasCurrent = chat === ChatState.chatSession;
|
|
LlmClient.chats.remove(chat);
|
|
if (wasCurrent)
|
|
ChatState.openDraft();
|
|
}
|
|
onLoadChatRequest: (chat, index) => {
|
|
ChatState.chatSession = chat;
|
|
openChat();
|
|
ChatState.inChat = true;
|
|
}
|
|
onNewChatRequest: {
|
|
ChatState.openDraft();
|
|
openChat();
|
|
ChatState.inChat = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: chatContent
|
|
|
|
ChatContent {
|
|
chatData: ChatState.chatSession
|
|
|
|
onRequestClose: {
|
|
stack.pop();
|
|
ChatState.inChat = false;
|
|
ChatState.openDraft();
|
|
}
|
|
}
|
|
}
|
|
}
|