gui: show disconnected state visually, remove session connected/ended messages
- Session list shows '(not connected)' when daemon disconnected - Chat area shows 'Not connected' placeholder when disconnected - Message input disabled and shows 'Not connected' when disconnected - Chat ListView hidden when disconnected - Remove sessionConnected/streamingDone signals (visual feedback is sufficient)
This commit is contained in:
parent
b4ae887089
commit
2b19cafc50
28
gui/main.qml
28
gui/main.qml
|
|
@ -491,13 +491,6 @@ ApplicationWindow {
|
|||
}
|
||||
scrollTimer.start()
|
||||
}
|
||||
function onSessionConnected() {
|
||||
chatModel.appendData("\n[[[info]]]\nsession connected\n[[[end]]]\n")
|
||||
scrollTimer.start()
|
||||
}
|
||||
function onStreamingDone() {
|
||||
chatModel.appendData("\n[[[info]]]\nsession ended\n[[[end]]]\n")
|
||||
}
|
||||
}
|
||||
|
||||
// --- Rename Error Dialog ---
|
||||
|
|
@ -928,14 +921,14 @@ ApplicationWindow {
|
|||
focus: false
|
||||
activeFocusOnTab: false
|
||||
|
||||
// Show placeholder when empty
|
||||
// Show placeholder when empty or disconnected
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
text: "(no sessions)"
|
||||
text: ollie.daemonConnected ? "(no sessions)" : "(not connected)"
|
||||
color: theme.midColor
|
||||
font.italic: true
|
||||
font.pixelSize: theme.fontSize > 0 ? theme.fontSize * 0.9 : 12
|
||||
visible: sessionList.count === 0
|
||||
visible: sessionList.count === 0 || !ollie.daemonConnected
|
||||
activeFocusOnTab: false
|
||||
}
|
||||
|
||||
|
|
@ -1209,14 +1202,18 @@ ApplicationWindow {
|
|||
Layout.fillHeight: true
|
||||
clip: true
|
||||
|
||||
// Placeholder when no agent selected
|
||||
// Placeholder when no agent selected or disconnected
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
text: ollie.activeSessionId ? "Select an agent to view chat" : "Select a session"
|
||||
text: {
|
||||
if (!ollie.daemonConnected) return "Not connected"
|
||||
if (!ollie.activeSessionId) return "Select a session"
|
||||
return "Select an agent to view chat"
|
||||
}
|
||||
color: theme.midColor
|
||||
font.italic: true
|
||||
font.pixelSize: theme.fontSize > 0 ? theme.fontSize : 12
|
||||
visible: !ollie.activeAgentId
|
||||
visible: !ollie.activeAgentId || !ollie.daemonConnected
|
||||
}
|
||||
|
||||
ListView {
|
||||
|
|
@ -1226,7 +1223,7 @@ ApplicationWindow {
|
|||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
visible: ollie.activeAgentId !== ""
|
||||
visible: ollie.daemonConnected && ollie.activeAgentId !== ""
|
||||
|
||||
onCountChanged: {
|
||||
if (count > 0)
|
||||
|
|
@ -1371,12 +1368,13 @@ property bool blockExpanded: {
|
|||
id: promptInput
|
||||
Layout.fillWidth: true
|
||||
placeholderText: {
|
||||
if (!ollie.daemonConnected) return "Not connected"
|
||||
if (!ollie.activeSessionId) return "No session"
|
||||
if (!ollie.activeAgentId) return "No agent"
|
||||
if (ollie.isSessionPaused(ollie.activeSessionId)) return "Session paused"
|
||||
return "Message..."
|
||||
}
|
||||
enabled: ollie.activeSessionId !== "" && ollie.activeAgentId !== "" && !ollie.isSessionPaused(ollie.activeSessionId)
|
||||
enabled: ollie.daemonConnected && ollie.activeSessionId !== "" && ollie.activeAgentId !== "" && !ollie.isSessionPaused(ollie.activeSessionId)
|
||||
wrapMode: TextEdit.Wrap
|
||||
|
||||
property string _lastText: ""
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@ Ollie9pClient::Ollie9pClient(QObject *parent)
|
|||
if (!data.isEmpty())
|
||||
emit chatReceived(QString::fromUtf8(data));
|
||||
});
|
||||
connect(m_chat, &StreamFsm::died, this, [this]() {
|
||||
emit streamingDone();
|
||||
});
|
||||
|
||||
// State stream — guarded, reads agent statewait. Auto-restarts until
|
||||
// session/agent is deselected (guard returns false).
|
||||
|
|
@ -81,7 +78,6 @@ Ollie9pClient::Ollie9pClient(QObject *parent)
|
|||
// Restart streams for the active agent if we have one
|
||||
if (!m_activeSessionId.isEmpty() && !m_agentId.isEmpty()) {
|
||||
startActiveAgentStreams();
|
||||
emit sessionConnected();
|
||||
}
|
||||
});
|
||||
connect(m_daemon, &NinePConnection::disconnected, this, [this]() {
|
||||
|
|
|
|||
|
|
@ -93,8 +93,6 @@ signals:
|
|||
void activeStateChanged();
|
||||
void agentStateChanged(const QString &sessionId, const QString &agentId, const QString &state);
|
||||
void chatReceived(const QString &text);
|
||||
void sessionConnected();
|
||||
void streamingDone(); // chat process exited (session killed)
|
||||
void rootBackendsLoadedChanged();
|
||||
void availableBackendsChanged();
|
||||
void rootAgentsLoadedChanged();
|
||||
|
|
|
|||
Reference in New Issue