chore: bump version to v2.33.5 and optimize sidebar UI

This commit is contained in:
g1nation
2026-05-01 19:33:35 +09:00
parent fad4725008
commit e696d29f2f
3 changed files with 64 additions and 9 deletions
+7
View File
@@ -1,3 +1,10 @@
# Patch Notes - v2.33.5 (2026-05-01)
## 🎨 UI Refinement
- **Sidebar Provider Update:** Optimized sidebar rendering and event handling for smoother navigation.
---
# Patch Notes - v2.33.4 (2026-05-01) # Patch Notes - v2.33.4 (2026-05-01)
## 🛠️ Manual Refinement & Stabilization ## 🛠️ Manual Refinement & Stabilization
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "g1nation", "name": "g1nation",
"displayName": "G1nation", "displayName": "G1nation",
"description": "High-performance autonomous local AI coding agent for VS Code. Features vectorized inference, asynchronous task management, and 100% offline processing.", "description": "High-performance autonomous local AI coding agent for VS Code. Features vectorized inference, asynchronous task management, and 100% offline processing.",
"version": "2.33.4", "version": "2.33.5",
"publisher": "connectailab", "publisher": "connectailab",
"license": "MIT", "license": "MIT",
"icon": "assets/icon.png", "icon": "assets/icon.png",
+56 -8
View File
@@ -322,7 +322,7 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
} }
const sessions = this._getSessions(); const sessions = this._getSessions();
const session = sessions.find(s => s.id === id); const session = sessions.find(s => s.id === id) || this._getSessionById(id);
if (session) { if (session) {
const history = Array.isArray(session.history) ? session.history : []; const history = Array.isArray(session.history) ? session.history : [];
if (history.length === 0) { if (history.length === 0) {
@@ -409,6 +409,35 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
.slice(0, 50); .slice(0, 50);
} }
private _getSessionById(id: string): ChatSession | null {
const rawSessions = this._context.globalState.get<any[]>('chat_sessions', []) || [];
const raw = rawSessions.find((session: any) => String(session?.id) === String(id));
if (!raw) return null;
const history = Array.isArray(raw.history)
? raw.history.filter((message: any) =>
message
&& (message.role === 'user' || message.role === 'assistant' || message.role === 'system')
&& message.content !== undefined
)
: [];
if (history.length === 0) return null;
const firstMsg = history.find((message: ChatMessage) => message.role === 'user')?.content;
const fallbackTitle = typeof firstMsg === 'string'
? firstMsg.substring(0, 50).replace(/\n/g, ' ') + (firstMsg.length > 50 ? '...' : '')
: 'Chat Session';
return {
id: String(raw.id),
title: String(raw.title || fallbackTitle),
timestamp: typeof raw.timestamp === 'number' ? raw.timestamp : Date.now(),
history,
brainProfileId: String(raw.brainProfileId || getActiveBrainProfile().id),
negativePrompt: String(raw.negativePrompt || '')
};
}
private async _putSessions(sessions: ChatSession[]) { private async _putSessions(sessions: ChatSession[]) {
await this._context.globalState.update('chat_sessions', sessions.slice(0, 50)); await this._context.globalState.update('chat_sessions', sessions.slice(0, 50));
} }
@@ -2108,15 +2137,21 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
break; break;
case 'restoreHistory': case 'restoreHistory':
case 'sessionLoaded': case 'sessionLoaded':
const historyData = msg.type === 'sessionLoaded' ? msg.value : msg; const historyPayload = msg.type === 'sessionLoaded' ? msg.value : msg.value;
const history = Array.isArray(historyData.history) ? historyData.history : (Array.isArray(historyData) ? historyData : []); const history = Array.isArray(historyPayload)
? historyPayload
: (Array.isArray(historyPayload?.history) ? historyPayload.history : []);
if (history && history.length > 0) { if (history && history.length > 0) {
chat.innerHTML = ''; chat.innerHTML = '';
history.forEach(m => addMsg(m.content, m.role === 'assistant' ? 'assistant' : 'user', m.rationale)); history.forEach(m => {
if (!m || m.internal) return;
addMsg(m.content, m.role === 'assistant' ? 'assistant' : 'user', m.rationale);
});
chat.scrollTop = chat.scrollHeight;
} }
if (historyData.negativePrompt !== undefined) { if (historyPayload?.negativePrompt !== undefined) {
negativePrompt.value = historyData.negativePrompt; negativePrompt.value = historyPayload.negativePrompt;
} }
historyOverlay.classList.remove('visible'); historyOverlay.classList.remove('visible');
break; break;
@@ -2163,8 +2198,21 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
historyList.innerHTML = ''; historyList.innerHTML = '';
msg.value.forEach(s => { msg.value.forEach(s => {
const el = document.createElement('div'); el.className = 'history-item'; const el = document.createElement('div'); el.className = 'history-item';
el.innerHTML = \`<div style="font-weight:600; color:var(--text-bright); mb-2">\${s.title}</div><div style="font-size:10px; color:var(--text-dim)">\${new Date(s.timestamp).toLocaleString()} · \${s.messageCount} msgs</div>\`; el.setAttribute('role', 'button');
el.onclick = () => vscode.postMessage({ type: 'loadSession', id: s.id }); el.tabIndex = 0;
el.dataset.sessionId = s.id;
el.innerHTML = \`<div style="font-weight:600; color:var(--text-bright); margin-bottom:2px;">\${s.title}</div><div style="font-size:10px; color:var(--text-dim)">\${new Date(s.timestamp).toLocaleString()} · \${s.messageCount} msgs</div>\`;
const load = () => {
if (!el.dataset.sessionId) return;
vscode.postMessage({ type: 'loadSession', id: el.dataset.sessionId });
};
el.addEventListener('click', load);
el.addEventListener('keydown', event => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
load();
}
});
historyList.appendChild(el); historyList.appendChild(el);
}); });
break; break;