@vincentbanana/banana-gui 0.4.8 → 0.4.9

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/ui/app.js +15 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincentbanana/banana-gui",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "Banana 的图形界面:本地服务 + 浏览器。黑白主题,自绘图标,无第三方 UI 依赖",
5
5
  "type": "module",
6
6
  "engines": {
@@ -71,7 +71,7 @@
71
71
  "electron-builder": "^25.0.0"
72
72
  },
73
73
  "dependencies": {
74
- "@vincentbanana/bananacli": "^0.4.6"
74
+ "@vincentbanana/bananacli": "^0.4.7"
75
75
  },
76
76
  "license": "MIT",
77
77
  "publishConfig": {
package/ui/app.js CHANGED
@@ -561,7 +561,7 @@ async function send() {
561
561
  const res = await fetch(API + 'chat', {
562
562
  method: 'POST',
563
563
  headers: { 'content-type': 'application/json' },
564
- body: JSON.stringify({ message: text, images }),
564
+ body: JSON.stringify({ message: text, images, session: state.info?.session?.id }),
565
565
  signal: controller.signal,
566
566
  });
567
567
  if (!res.ok) throw new Error((await res.json().catch(() => ({}))).error ?? res.statusText);
@@ -1399,7 +1399,20 @@ function bind() {
1399
1399
  hydrate();
1400
1400
  loadTheme();
1401
1401
 
1402
- $('newChat').addEventListener('click', () => post('session', { action: 'new' }).then(() => refresh(true)));
1402
+ $('newChat').addEventListener('click', async () => {
1403
+ try {
1404
+ // 直接用返回的会话,不再 refresh:多一次 lastActive 解析就多一次串回旧对话的机会
1405
+ const result = await post('session', { action: 'new' });
1406
+ if (result?.info) state.info = result.info;
1407
+ if (result?.sessions) state.sessions = result.sessions;
1408
+ renderHeader();
1409
+ renderSidebar();
1410
+ renderThread();
1411
+ $('input').focus();
1412
+ } catch (error) {
1413
+ toast('新建对话失败:' + (error?.message ?? error));
1414
+ }
1415
+ });
1403
1416
  $('abortBtn').addEventListener('click', async () => { controller?.abort(); await post('abort'); });
1404
1417
  $('modelBtn').addEventListener('click', openSettings);
1405
1418
  $('openSettings').addEventListener('click', openSettings);