pi-web-ui 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/agent-service.js +26 -0
- package/package.json +1 -1
|
@@ -1863,6 +1863,32 @@ export class ClientSession {
|
|
|
1863
1863
|
this.flushSnapshot();
|
|
1864
1864
|
}
|
|
1865
1865
|
async newChat() {
|
|
1866
|
+
// Reuse an already-open blank conversation instead of piling up new ones
|
|
1867
|
+
// on every click: if the active chat has no messages it IS the new chat
|
|
1868
|
+
// (focus already on it); otherwise switch to the first blank one.
|
|
1869
|
+
const isBlank = (c) => {
|
|
1870
|
+
try {
|
|
1871
|
+
return c.session.getSessionStats().totalMessages === 0;
|
|
1872
|
+
}
|
|
1873
|
+
catch {
|
|
1874
|
+
// session being replaced — treat as used so we don't switch onto it
|
|
1875
|
+
return false;
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
const active = this.conv;
|
|
1879
|
+
if (active && isBlank(active)) {
|
|
1880
|
+
this.flushSnapshot();
|
|
1881
|
+
return;
|
|
1882
|
+
}
|
|
1883
|
+
for (const conv of this.convs.values()) {
|
|
1884
|
+
if (conv.id === this.activeId)
|
|
1885
|
+
continue;
|
|
1886
|
+
if (isBlank(conv)) {
|
|
1887
|
+
await this.switchConversation(conv.id);
|
|
1888
|
+
this.flushSnapshot();
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1866
1892
|
if (this.convs.size >= MAX_OPEN_CONVERSATIONS) {
|
|
1867
1893
|
this.emit({
|
|
1868
1894
|
type: "notice",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-web-ui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Web chat interface for the pi coding agent, powered by the pi SDK (@earendil-works/pi-coding-agent) — one-command run, Docker/systemd/launchd deployable",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|