gui: make switchAgent the only stream-start path
- setActiveSessionId remains session-only and never starts streams - setActiveAgentId now clears any existing per-agent streams and only updates selection/state - switchAgent is explicitly the only place that starts chat/statewait - onStateFinished only reopens for the current explicit selection
This commit is contained in:
parent
22e58b348f
commit
38cd1313ec
|
|
@ -196,7 +196,12 @@ QStringList Ollie9pClient::getAgents(const QString &sessionId)
|
||||||
|
|
||||||
void Ollie9pClient::setActiveAgentId(const QString &agentId)
|
void Ollie9pClient::setActiveAgentId(const QString &agentId)
|
||||||
{
|
{
|
||||||
|
if (m_agentId == agentId) return;
|
||||||
|
stopStreams();
|
||||||
m_agentId = agentId;
|
m_agentId = agentId;
|
||||||
|
m_activeState = "idle";
|
||||||
|
emit activeAgentIdChanged();
|
||||||
|
emit activeStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ollie9pClient::switchAgent(const QString &sessionId, const QString &agentId)
|
void Ollie9pClient::switchAgent(const QString &sessionId, const QString &agentId)
|
||||||
|
|
@ -218,6 +223,7 @@ void Ollie9pClient::switchAgent(const QString &sessionId, const QString &agentId
|
||||||
emit activeAgentIdChanged();
|
emit activeAgentIdChanged();
|
||||||
emit activeStateChanged();
|
emit activeStateChanged();
|
||||||
|
|
||||||
|
// switchAgent is the ONLY path that starts per-agent streams.
|
||||||
startChatStream();
|
startChatStream();
|
||||||
startStateStream();
|
startStateStream();
|
||||||
}
|
}
|
||||||
|
|
@ -504,7 +510,9 @@ void Ollie9pClient::onStateFinished(int, QProcess::ExitStatus)
|
||||||
{
|
{
|
||||||
m_stateProc->deleteLater();
|
m_stateProc->deleteLater();
|
||||||
m_stateProc = nullptr;
|
m_stateProc = nullptr;
|
||||||
startStateStream();
|
// Reopen only for the current explicit agent selection.
|
||||||
|
if (!m_activeSessionId.isEmpty() && !m_agentId.isEmpty())
|
||||||
|
startStateStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ollie9pClient::startEventStream()
|
void Ollie9pClient::startEventStream()
|
||||||
|
|
|
||||||
Reference in New Issue