add agent selector to new session dialog
This commit is contained in:
parent
1cce42f2d6
commit
c5a5c0c9b9
|
|
@ -181,8 +181,10 @@ ApplicationWindow {
|
|||
function openNewSessionDialog() {
|
||||
nameInput.text = ""
|
||||
newSessionDialog.backendModel = dbus.listBackends()
|
||||
newSessionDialog.agentModel = dbus.listAgents()
|
||||
newSessionDialog.cwdField.text = dbus.activeCwd || ""
|
||||
newSessionDialog.backendCombo.currentIndex = 0
|
||||
newSessionDialog.agentCombo.currentIndex = 0
|
||||
newSessionDialog.modelCombo.editText = ""
|
||||
newSessionDialog.open()
|
||||
}
|
||||
|
|
@ -195,19 +197,22 @@ ApplicationWindow {
|
|||
width: 450
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
|
||||
property alias cwdField: cwdInput
|
||||
property alias backendCombo: backendSelect
|
||||
property alias modelCombo: modelSelect
|
||||
property var backendModel: []
|
||||
property alias cwdField: cwdInput
|
||||
property alias backendCombo: backendSelect
|
||||
property alias agentCombo: agentSelect
|
||||
property alias modelCombo: modelSelect
|
||||
property var backendModel: []
|
||||
property var agentModel: []
|
||||
|
||||
onAccepted: {
|
||||
var cwd = cwdInput.text.trim()
|
||||
if (cwd === "") cwd = dbus.activeCwd || ""
|
||||
var backend = backendSelect.currentText
|
||||
var model = modelSelect.editText.trim() || modelSelect.currentText
|
||||
var name = nameInput.text.trim()
|
||||
dbus.createSession(cwd, backend, model, name)
|
||||
}
|
||||
onAccepted: {
|
||||
var cwd = cwdInput.text.trim()
|
||||
if (cwd === "") cwd = dbus.activeCwd || ""
|
||||
var backend = backendSelect.currentText
|
||||
var model = modelSelect.editText.trim() || modelSelect.currentText
|
||||
var agent = agentSelect.currentText
|
||||
var name = nameInput.text.trim()
|
||||
dbus.createSession(cwd, backend, model, name, agent)
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
|
|
@ -251,6 +256,14 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
Label { text: "Agent:" }
|
||||
ComboBox {
|
||||
id: agentSelect
|
||||
Layout.fillWidth: true
|
||||
model: newSessionDialog.agentModel
|
||||
currentIndex: 0
|
||||
}
|
||||
|
||||
Label { text: "Model:" }
|
||||
ComboBox {
|
||||
id: modelSelect
|
||||
|
|
|
|||
37
gui/main.qml
37
gui/main.qml
|
|
@ -181,8 +181,10 @@ ApplicationWindow {
|
|||
function openNewSessionDialog() {
|
||||
nameInput.text = ""
|
||||
newSessionDialog.backendModel = dbus.listBackends()
|
||||
newSessionDialog.agentModel = dbus.listAgents()
|
||||
newSessionDialog.cwdField.text = dbus.activeCwd || ""
|
||||
newSessionDialog.backendCombo.currentIndex = 0
|
||||
newSessionDialog.agentCombo.currentIndex = 0
|
||||
newSessionDialog.modelCombo.editText = ""
|
||||
newSessionDialog.open()
|
||||
}
|
||||
|
|
@ -195,19 +197,22 @@ ApplicationWindow {
|
|||
width: 450
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
|
||||
property alias cwdField: cwdInput
|
||||
property alias backendCombo: backendSelect
|
||||
property alias modelCombo: modelSelect
|
||||
property var backendModel: []
|
||||
property alias cwdField: cwdInput
|
||||
property alias backendCombo: backendSelect
|
||||
property alias agentCombo: agentSelect
|
||||
property alias modelCombo: modelSelect
|
||||
property var backendModel: []
|
||||
property var agentModel: []
|
||||
|
||||
onAccepted: {
|
||||
let cwd = cwdInput.text.trim()
|
||||
if (cwd === "") cwd = dbus.activeCwd || ""
|
||||
let backend = backendSelect.currentText
|
||||
let model = modelSelect.editText.trim() || modelSelect.currentText
|
||||
let name = nameInput.text.trim()
|
||||
dbus.createSession(cwd, backend, model, name)
|
||||
}
|
||||
onAccepted: {
|
||||
let cwd = cwdInput.text.trim()
|
||||
if (cwd === "") cwd = dbus.activeCwd || ""
|
||||
let backend = backendSelect.currentText
|
||||
let model = modelSelect.editText.trim() || modelSelect.currentText
|
||||
let agent = agentSelect.currentText
|
||||
let name = nameInput.text.trim()
|
||||
dbus.createSession(cwd, backend, model, name, agent)
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
|
|
@ -251,6 +256,14 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
Label { text: "Agent:" }
|
||||
ComboBox {
|
||||
id: agentSelect
|
||||
Layout.fillWidth: true
|
||||
model: newSessionDialog.agentModel
|
||||
currentIndex: 0
|
||||
}
|
||||
|
||||
Label { text: "Model:" }
|
||||
ComboBox {
|
||||
id: modelSelect
|
||||
|
|
|
|||
|
|
@ -269,11 +269,20 @@ void OllieDBusClient::onFetchConfigFinished(QDBusPendingCallWatcher *watcher)
|
|||
|
||||
// --- User-initiated actions (fire-and-forget async) ---
|
||||
|
||||
QString OllieDBusClient::createSession(const QString &cwd, const QString &backend, const QString &model, const QString &name)
|
||||
QStringList OllieDBusClient::listAgents()
|
||||
{
|
||||
QDBusReply<QStringList> reply = m_iface->call("ListAgents");
|
||||
if (reply.isValid())
|
||||
return reply.value();
|
||||
return {};
|
||||
}
|
||||
|
||||
QString OllieDBusClient::createSession(const QString &cwd, const QString &backend, const QString &model, const QString &name, const QString &agent)
|
||||
{
|
||||
QString dir = cwd.isEmpty() ? QDir::homePath() : cwd;
|
||||
QString agentName = agent.isEmpty() ? QString("default") : agent;
|
||||
auto *watcher = new QDBusPendingCallWatcher(
|
||||
m_iface->asyncCall("CreateSession", dir, backend, model, QString("default"), QString(), QString()),
|
||||
m_iface->asyncCall("CreateSession", dir, backend, model, agentName, QString(), QString()),
|
||||
this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, name](QDBusPendingCallWatcher *w) {
|
||||
QDBusPendingReply<QString> reply = *w;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ public:
|
|||
|
||||
Q_INVOKABLE void refreshSessions();
|
||||
Q_INVOKABLE void fetchChat();
|
||||
Q_INVOKABLE QString createSession(const QString &cwd, const QString &backend = QString(), const QString &model = QString(), const QString &name = QString());
|
||||
Q_INVOKABLE QString createSession(const QString &cwd, const QString &backend = QString(), const QString &model = QString(), const QString &name = QString(), const QString &agent = QString());
|
||||
Q_INVOKABLE QStringList listAgents();
|
||||
Q_INVOKABLE void createSessionWithDialog();
|
||||
Q_INVOKABLE bool killSession(const QString &sessionId);
|
||||
Q_INVOKABLE bool renameSession(const QString &sessionId, const QString &newName);
|
||||
|
|
|
|||
Reference in New Issue