Testing
This commit is contained in:
+171
@@ -0,0 +1,171 @@
|
||||
// ── Side panel ───────────────────────────────────────────────────────────────
|
||||
|
||||
if (chrome.sidePanel) {
|
||||
chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }).catch(() => {});
|
||||
}
|
||||
chrome.action.onClicked.addListener((tab) => {
|
||||
if (chrome.sidePanel && tab.id) chrome.sidePanel.open({ tabId: tab.id }).catch(() => {});
|
||||
});
|
||||
|
||||
// ── Active stream registry (for cancellation) ────────────────────────────────
|
||||
|
||||
const activeStreams = new Map(); // requestId → AbortController
|
||||
|
||||
// ── Message router ────────────────────────────────────────────────────────────
|
||||
|
||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message.action === 'OLLAMA_GET') {
|
||||
handleGet(message, sendResponse);
|
||||
return true;
|
||||
}
|
||||
if (message.action === 'OLLAMA_FETCH') {
|
||||
handleStream(message);
|
||||
sendResponse({ started: true });
|
||||
return false;
|
||||
}
|
||||
if (message.action === 'CANCEL_STREAM') {
|
||||
const ctrl = activeStreams.get(message.requestId);
|
||||
if (ctrl) { ctrl.abort(); activeStreams.delete(message.requestId); }
|
||||
sendResponse({ ok: true });
|
||||
return false;
|
||||
}
|
||||
if (message.action === 'GET_PAGE_CONTENT') {
|
||||
handleGetPageContent(message.tabId, sendResponse);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// ── Helpers ───────────────────────────────────────────────────────────────────
|
||||
|
||||
function broadcast(msg) {
|
||||
chrome.runtime.sendMessage(msg).catch(() => {});
|
||||
}
|
||||
|
||||
// ── Page content relay ────────────────────────────────────────────────────────
|
||||
|
||||
function handleGetPageContent(tabId, sendResponse) {
|
||||
chrome.tabs.sendMessage(tabId, { type: 'GET_PAGE_CONTENT' }, (response) => {
|
||||
if (chrome.runtime.lastError) {
|
||||
sendResponse({ error: chrome.runtime.lastError.message });
|
||||
return;
|
||||
}
|
||||
sendResponse(response || { error: 'Content script did not respond' });
|
||||
});
|
||||
}
|
||||
|
||||
// ── Non-streaming GET ─────────────────────────────────────────────────────────
|
||||
|
||||
async function handleGet(message, sendResponse) {
|
||||
try {
|
||||
const res = await fetch(message.url, { method: 'GET', headers: message.headers || {} });
|
||||
if (!res.ok) { sendResponse({ ok: false, status: res.status, error: 'HTTP ' + res.status }); return; }
|
||||
const data = await res.json();
|
||||
sendResponse({ ok: true, data });
|
||||
} catch (e) {
|
||||
sendResponse({ ok: false, error: e.message });
|
||||
}
|
||||
}
|
||||
|
||||
// ── Streaming POST ────────────────────────────────────────────────────────────
|
||||
// Requests go through the background service worker so they carry no page
|
||||
// Origin header — avoiding 403s from reverse proxies that block extension origins.
|
||||
|
||||
async function handleStream(message) {
|
||||
const { url, headers, body, requestId } = message;
|
||||
const controller = new AbortController();
|
||||
activeStreams.set(requestId, controller);
|
||||
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: headers || {},
|
||||
body,
|
||||
signal: controller.signal
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
let errBody = '';
|
||||
try { errBody = await res.text(); } catch (_) {}
|
||||
broadcast({ action: 'STREAM_ERROR', requestId,
|
||||
error: 'HTTP ' + res.status + (errBody ? ': ' + errBody.slice(0, 200) : '') });
|
||||
return;
|
||||
}
|
||||
|
||||
const reader = res.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
let buf = '';
|
||||
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
|
||||
buf += decoder.decode(value, { stream: true });
|
||||
const lines = buf.split('\n');
|
||||
buf = lines.pop() || '';
|
||||
|
||||
for (const line of lines) {
|
||||
const trimmed = line.trim();
|
||||
if (!trimmed) continue;
|
||||
let chunk;
|
||||
try { chunk = JSON.parse(trimmed); } catch (_) { continue; }
|
||||
|
||||
if (chunk.error) {
|
||||
broadcast({ action: 'STREAM_ERROR', requestId, error: chunk.error });
|
||||
return;
|
||||
}
|
||||
|
||||
if (chunk.message) {
|
||||
if (chunk.message.thinking) {
|
||||
broadcast({ action: 'STREAM_THINKING', requestId, text: chunk.message.thinking });
|
||||
}
|
||||
if (chunk.message.content) {
|
||||
broadcast({ action: 'STREAM_CHUNK', requestId, text: chunk.message.content });
|
||||
}
|
||||
}
|
||||
|
||||
if (chunk.done) {
|
||||
if (chunk.eval_count || chunk.total_duration) {
|
||||
broadcast({
|
||||
action: 'STREAM_METRICS', requestId,
|
||||
metrics: {
|
||||
eval_count: chunk.eval_count || 0,
|
||||
eval_duration: chunk.eval_duration || 0,
|
||||
prompt_eval_count: chunk.prompt_eval_count || 0,
|
||||
total_duration: chunk.total_duration || 0
|
||||
}
|
||||
});
|
||||
}
|
||||
broadcast({ action: 'STREAM_DONE', requestId });
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Drain remaining buffer
|
||||
if (buf.trim()) {
|
||||
try {
|
||||
const last = JSON.parse(buf.trim());
|
||||
if (last.message && last.message.content) {
|
||||
broadcast({ action: 'STREAM_CHUNK', requestId, text: last.message.content });
|
||||
}
|
||||
if (last.error) { broadcast({ action: 'STREAM_ERROR', requestId, error: last.error }); return; }
|
||||
if (last.done && (last.eval_count || last.total_duration)) {
|
||||
broadcast({ action: 'STREAM_METRICS', requestId,
|
||||
metrics: { eval_count: last.eval_count || 0, eval_duration: last.eval_duration || 0,
|
||||
prompt_eval_count: last.prompt_eval_count || 0, total_duration: last.total_duration || 0 } });
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
broadcast({ action: 'STREAM_DONE', requestId });
|
||||
|
||||
} catch (e) {
|
||||
if (e.name === 'AbortError') {
|
||||
broadcast({ action: 'STREAM_DONE', requestId, aborted: true });
|
||||
} else {
|
||||
broadcast({ action: 'STREAM_ERROR', requestId, error: e.message });
|
||||
}
|
||||
} finally {
|
||||
activeStreams.delete(requestId);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
console.log('[Ollama Sidebar] content script loaded on', location.href);
|
||||
|
||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message.type === 'GET_PAGE_CONTENT') {
|
||||
try {
|
||||
const clone = document.body.cloneNode(true);
|
||||
clone.querySelectorAll('script, style, noscript, iframe, svg, canvas').forEach((el) => el.remove());
|
||||
const text = (clone.textContent || '').replace(/\s+/g, ' ').trim().slice(0, 8000);
|
||||
sendResponse({ title: document.title, url: location.href, content: text });
|
||||
} catch (e) {
|
||||
sendResponse({ title: document.title, url: location.href, content: '' });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,203 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Ollama Sidebar — Icon Generator</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: #161616;
|
||||
color: #e4e4e4;
|
||||
padding: 32px 24px;
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 { font-size: 20px; margin-bottom: 8px; }
|
||||
p { color: #888; font-size: 13px; line-height: 1.6; margin-bottom: 24px; }
|
||||
code {
|
||||
background: #2a2a2a;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-family: monospace;
|
||||
}
|
||||
.icons-row {
|
||||
display: flex;
|
||||
gap: 32px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
.icon-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
canvas {
|
||||
border: 1px solid #333;
|
||||
border-radius: 4px;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
.size-label {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
.save-btn {
|
||||
background: #7c3aed;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 7px 16px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
font-family: inherit;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.save-btn:hover { background: #6d28d9; }
|
||||
.save-all-btn {
|
||||
background: #5b21b6;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 10px 24px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
font-weight: 500;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.save-all-btn:hover { background: #4c1d95; }
|
||||
.instructions {
|
||||
background: #1f1f1f;
|
||||
border: 1px solid #333;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
margin-top: 24px;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.7;
|
||||
color: #999;
|
||||
}
|
||||
.instructions ol { padding-left: 18px; }
|
||||
.instructions li { margin-bottom: 4px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Ollama Sidebar — Icon Generator</h1>
|
||||
<p>
|
||||
Click <strong>Save All Icons</strong> (or save each individually), then place the downloaded
|
||||
files inside the <code>icons/</code> folder before loading the extension.
|
||||
</p>
|
||||
|
||||
<div class="icons-row" id="icons-row"></div>
|
||||
|
||||
<button class="save-all-btn" onclick="saveAll()">Save All Icons</button>
|
||||
|
||||
<div class="instructions">
|
||||
<strong>Steps to use:</strong>
|
||||
<ol>
|
||||
<li>Click <em>Save All Icons</em> — your browser will download three PNG files.</li>
|
||||
<li>Move <code>icon16.png</code>, <code>icon48.png</code>, and <code>icon128.png</code> into the <code>icons/</code> folder.</li>
|
||||
<li>Load the extension: <em>Extensions → Manage Extensions → Load unpacked</em> (Chrome) or <em>Tools → Extensions → Install from Disk</em> (Orion).</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var SIZES = [16, 48, 128];
|
||||
var canvases = {};
|
||||
|
||||
function drawIcon(size) {
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = size;
|
||||
canvas.height = size;
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
// Purple gradient background
|
||||
var grad = ctx.createLinearGradient(0, 0, size, size);
|
||||
grad.addColorStop(0, '#7c3aed');
|
||||
grad.addColorStop(1, '#4f46e5');
|
||||
|
||||
var r = Math.max(2, Math.round(size * 0.18));
|
||||
ctx.beginPath();
|
||||
if (ctx.roundRect) {
|
||||
ctx.roundRect(0, 0, size, size, r);
|
||||
} else {
|
||||
// Fallback for older browsers
|
||||
ctx.moveTo(r, 0);
|
||||
ctx.lineTo(size - r, 0);
|
||||
ctx.arcTo(size, 0, size, r, r);
|
||||
ctx.lineTo(size, size - r);
|
||||
ctx.arcTo(size, size, size - r, size, r);
|
||||
ctx.lineTo(r, size);
|
||||
ctx.arcTo(0, size, 0, size - r, r);
|
||||
ctx.lineTo(0, r);
|
||||
ctx.arcTo(0, 0, r, 0, r);
|
||||
ctx.closePath();
|
||||
}
|
||||
ctx.fillStyle = grad;
|
||||
ctx.fill();
|
||||
|
||||
// "O" letter centred
|
||||
ctx.fillStyle = 'rgba(255,255,255,0.95)';
|
||||
var fontSize = Math.round(size * 0.56);
|
||||
ctx.font = 'bold ' + fontSize + 'px -apple-system, BlinkMacSystemFont, sans-serif';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.fillText('O', size / 2, size * 0.52);
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function buildUI() {
|
||||
var row = document.getElementById('icons-row');
|
||||
SIZES.forEach(function (size) {
|
||||
var canvas = drawIcon(size);
|
||||
canvases[size] = canvas;
|
||||
|
||||
// Scale canvas visually so small ones are visible
|
||||
var displaySize = Math.max(size, 64);
|
||||
canvas.style.width = displaySize + 'px';
|
||||
canvas.style.height = displaySize + 'px';
|
||||
|
||||
var card = document.createElement('div');
|
||||
card.className = 'icon-card';
|
||||
|
||||
var label = document.createElement('div');
|
||||
label.className = 'size-label';
|
||||
label.textContent = size + 'x' + size;
|
||||
|
||||
var btn = document.createElement('button');
|
||||
btn.className = 'save-btn';
|
||||
btn.textContent = 'Save';
|
||||
btn.onclick = (function (s) {
|
||||
return function () { saveIcon(s); };
|
||||
}(size));
|
||||
|
||||
card.appendChild(canvas);
|
||||
card.appendChild(label);
|
||||
card.appendChild(btn);
|
||||
row.appendChild(card);
|
||||
});
|
||||
}
|
||||
|
||||
function saveIcon(size) {
|
||||
var canvas = canvases[size];
|
||||
var link = document.createElement('a');
|
||||
link.download = 'icon' + size + '.png';
|
||||
link.href = canvas.toDataURL('image/png');
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
||||
function saveAll() {
|
||||
SIZES.forEach(function (size, i) {
|
||||
// Slight delay between downloads to avoid browser blocking multiple saves
|
||||
setTimeout(function () { saveIcon(size); }, i * 200);
|
||||
});
|
||||
}
|
||||
|
||||
buildUI();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+1213
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 261 B |
Binary file not shown.
|
After Width: | Height: | Size: 547 B |
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Ollama Sidebar",
|
||||
"version": "1.0.0",
|
||||
"description": "Chat with local Ollama models from a browser sidebar",
|
||||
"permissions": ["storage", "sidePanel", "tabs", "activeTab", "scripting"],
|
||||
"host_permissions": ["<all_urls>"],
|
||||
"background": {
|
||||
"service_worker": "background.js"
|
||||
},
|
||||
"action": {
|
||||
"default_title": "Ollama Sidebar",
|
||||
"default_icon": {
|
||||
"16": "icons/icon16.png",
|
||||
"48": "icons/icon48.png",
|
||||
"128": "icons/icon128.png"
|
||||
}
|
||||
},
|
||||
"side_panel": {
|
||||
"default_path": "sidepanel.html"
|
||||
},
|
||||
"sidebar_action": {
|
||||
"default_panel": "sidepanel.html",
|
||||
"default_title": "Ollama Sidebar",
|
||||
"default_icon": "icons/icon48.png"
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["content.js"],
|
||||
"run_at": "document_idle"
|
||||
}
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"resources": ["marked.min.js", "highlight.min.js", "marked.min.css"],
|
||||
"matches": ["<all_urls>"]
|
||||
}
|
||||
],
|
||||
"icons": {
|
||||
"16": "icons/icon16.png",
|
||||
"48": "icons/icon48.png",
|
||||
"128": "icons/icon128.png"
|
||||
}
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<head><title>404 Not Found</title></head>
|
||||
<body>
|
||||
<center><h1>404 Not Found</h1></center>
|
||||
<hr><center>nginx</center>
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+6
File diff suppressed because one or more lines are too long
+579
@@ -0,0 +1,579 @@
|
||||
/* ── Reset ─────────────────────────────────────────────────── */
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
/* ── Dark theme (default) ──────────────────────────────────── */
|
||||
:root {
|
||||
--bg0: #111114;
|
||||
--bg1: #1a1a1f;
|
||||
--bg2: #222228;
|
||||
--bg3: #2a2a32;
|
||||
--bg4: #32323c;
|
||||
--fg1: #e2e2e8;
|
||||
--fg2: #8888a0;
|
||||
--fg3: #55556a;
|
||||
--accent: #7c3aed;
|
||||
--acc-h: #6d28d9;
|
||||
--acc-d: rgba(124,58,237,.15);
|
||||
--acc-dd: rgba(124,58,237,.08);
|
||||
--border: #2e2e38;
|
||||
--focus: #7c3aed;
|
||||
--ok: #22c55e;
|
||||
--err: #ef4444;
|
||||
--warn: #f59e0b;
|
||||
--scroll: #3a3a48;
|
||||
--code-bg: #0d0d12;
|
||||
--ububble: #1d4ed8;
|
||||
--ububble-text: #fff;
|
||||
--abubble: #1e1e26;
|
||||
--abubble-border: #2e2e38;
|
||||
--think-bg: rgba(245,158,11,.07);
|
||||
--think-border: rgba(245,158,11,.25);
|
||||
--think-text: #c8a840;
|
||||
--meta-text: #66667a;
|
||||
--chip-bg: #2a2a38;
|
||||
--chip-text: #a0a0c0;
|
||||
--danger: #ef4444;
|
||||
}
|
||||
|
||||
/* ── Light theme ───────────────────────────────────────────── */
|
||||
[data-theme="light"] {
|
||||
--bg0: #f0f2f5;
|
||||
--bg1: #ffffff;
|
||||
--bg2: #f8f8fb;
|
||||
--bg3: #eeeff4;
|
||||
--bg4: #e4e5ec;
|
||||
--fg1: #1a1a2e;
|
||||
--fg2: #55556e;
|
||||
--fg3: #9999b0;
|
||||
--border: #dddde8;
|
||||
--focus: #7c3aed;
|
||||
--ok: #16a34a;
|
||||
--err: #dc2626;
|
||||
--warn: #d97706;
|
||||
--scroll: #ccccdc;
|
||||
--code-bg: #f4f4f8;
|
||||
--ububble: #2563eb;
|
||||
--ububble-text: #fff;
|
||||
--abubble: #ffffff;
|
||||
--abubble-border: #dddde8;
|
||||
--think-bg: rgba(217,119,6,.07);
|
||||
--think-border: rgba(217,119,6,.3);
|
||||
--think-text: #92660a;
|
||||
--meta-text: #9999b0;
|
||||
--chip-bg: #e8e8f2;
|
||||
--chip-text: #5555a0;
|
||||
}
|
||||
|
||||
/* ── Base ──────────────────────────────────────────────────── */
|
||||
html, body {
|
||||
width: 100%; height: 100%; overflow: hidden;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
|
||||
font-size: 13px; line-height: 1.5;
|
||||
background: var(--bg0); color: var(--fg1);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
#app {
|
||||
display: flex; flex-direction: column;
|
||||
height: 100vh; width: 100%; overflow: hidden;
|
||||
background: var(--bg0); color: var(--fg1);
|
||||
transition: background .2s, color .2s;
|
||||
}
|
||||
|
||||
/* ── Scrollbar ─────────────────────────────────────────────── */
|
||||
::-webkit-scrollbar { width: 4px; height: 4px; }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 2px; }
|
||||
|
||||
/* ── Header ────────────────────────────────────────────────── */
|
||||
header {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 8px 11px;
|
||||
background: var(--bg1); border-bottom: 1px solid var(--border);
|
||||
flex-shrink: 0; min-height: 40px; z-index: 2;
|
||||
}
|
||||
.h-left, .h-right { display: flex; align-items: center; gap: 5px; }
|
||||
.app-title { font-weight: 700; font-size: 13px; letter-spacing: .02em; }
|
||||
|
||||
.status-dot {
|
||||
width: 7px; height: 7px; border-radius: 50%;
|
||||
background: var(--warn); flex-shrink: 0;
|
||||
transition: background .3s;
|
||||
}
|
||||
.status-dot.connected { background: var(--ok); }
|
||||
.status-dot.error { background: var(--err); }
|
||||
|
||||
/* ── Buttons ───────────────────────────────────────────────── */
|
||||
.icon-btn {
|
||||
background: none; border: none; cursor: pointer;
|
||||
color: var(--fg2); font-size: 16px;
|
||||
padding: 4px 5px; border-radius: 5px; line-height: 1;
|
||||
transition: background .12s, color .12s;
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.icon-btn:hover { background: var(--bg3); color: var(--fg1); }
|
||||
.icon-btn.active { color: var(--accent); }
|
||||
.icon-btn.sm { font-size: 13px; padding: 3px 4px; }
|
||||
.icon-btn.danger:hover { color: var(--err); }
|
||||
|
||||
.primary-btn {
|
||||
width: 100%; padding: 8px 12px;
|
||||
background: var(--accent); color: #fff;
|
||||
border: none; border-radius: 6px; cursor: pointer;
|
||||
font-size: 13px; font-weight: 500; font-family: inherit;
|
||||
transition: background .12s;
|
||||
}
|
||||
.primary-btn:hover { background: var(--acc-h); }
|
||||
.primary-btn:active { transform: scale(.98); }
|
||||
.primary-btn.sm { padding: 5px 10px; font-size: 12px; width: auto; }
|
||||
|
||||
.pill-btn {
|
||||
background: var(--bg3); border: 1px solid var(--border);
|
||||
color: var(--fg2); padding: 3px 10px;
|
||||
border-radius: 20px; cursor: pointer; font-size: 11.5px; font-family: inherit;
|
||||
transition: background .12s, border-color .12s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pill-btn:hover { background: var(--bg4); border-color: var(--accent); color: var(--fg1); }
|
||||
|
||||
/* ── Drop panels (settings + sessions) ────────────────────── */
|
||||
.drop-panel {
|
||||
background: var(--bg1); border-bottom: 1px solid var(--border);
|
||||
padding: 11px; flex-shrink: 0;
|
||||
display: flex; flex-direction: column; gap: 9px;
|
||||
overflow-y: auto; max-height: 52vh;
|
||||
}
|
||||
.drop-panel.hidden { display: none; }
|
||||
|
||||
.field-group { display: flex; flex-direction: column; gap: 4px; }
|
||||
.field-lbl {
|
||||
font-size: 10px; font-weight: 600; text-transform: uppercase;
|
||||
letter-spacing: .06em; color: var(--fg2);
|
||||
display: flex; align-items: center; gap: 4px;
|
||||
}
|
||||
.hint { text-transform: none; font-weight: 400; letter-spacing: 0; color: var(--fg3); }
|
||||
|
||||
.field-group input {
|
||||
width: 100%; background: var(--bg0);
|
||||
border: 1px solid var(--border); color: var(--fg1);
|
||||
padding: 6px 9px; border-radius: 6px;
|
||||
font-size: 13px; font-family: inherit; outline: none;
|
||||
transition: border-color .12s;
|
||||
}
|
||||
.field-group input:focus { border-color: var(--focus); }
|
||||
|
||||
.input-row-inline { display: flex; gap: 4px; align-items: center; }
|
||||
.input-row-inline input { flex: 1; }
|
||||
|
||||
.status-line {
|
||||
font-size: 11.5px; text-align: center; min-height: 14px;
|
||||
color: var(--fg3); transition: color .2s;
|
||||
}
|
||||
.status-line.ok { color: var(--ok); }
|
||||
.status-line.err { color: var(--err); }
|
||||
|
||||
/* ── Sessions panel ────────────────────────────────────────── */
|
||||
.panel-hdr {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.panel-title { font-size: 11px; font-weight: 600; text-transform: uppercase;
|
||||
letter-spacing: .06em; color: var(--fg2); }
|
||||
|
||||
.sessions-list { display: flex; flex-direction: column; gap: 2px; }
|
||||
|
||||
.session-item {
|
||||
display: flex; align-items: center; gap: 6px;
|
||||
padding: 7px 9px; border-radius: 7px; cursor: pointer;
|
||||
border: 1px solid transparent;
|
||||
transition: background .12s, border-color .12s;
|
||||
min-height: 36px;
|
||||
}
|
||||
.session-item:hover { background: var(--bg3); }
|
||||
.session-item.active { background: var(--acc-d); border-color: var(--accent); }
|
||||
|
||||
.session-item-name {
|
||||
flex: 1; font-size: 12.5px; white-space: nowrap;
|
||||
overflow: hidden; text-overflow: ellipsis; min-width: 0;
|
||||
}
|
||||
.session-item-meta { font-size: 10.5px; color: var(--fg3); white-space: nowrap; }
|
||||
.session-item-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
|
||||
.session-item:hover .session-item-actions { opacity: 1; }
|
||||
|
||||
/* ── Session bar ───────────────────────────────────────────── */
|
||||
.session-bar {
|
||||
display: flex; align-items: center; gap: 6px;
|
||||
padding: 5px 10px 5px 12px;
|
||||
background: var(--bg1); border-bottom: 1px solid var(--border);
|
||||
flex-shrink: 0; min-height: 34px;
|
||||
}
|
||||
.session-name {
|
||||
flex: 1; font-size: 12.5px; font-weight: 500;
|
||||
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||
cursor: text; color: var(--fg1);
|
||||
}
|
||||
.session-bar-actions { display: flex; gap: 2px; flex-shrink: 0; }
|
||||
|
||||
/* ── Chat area ─────────────────────────────────────────────── */
|
||||
.chat-area {
|
||||
flex: 1; overflow-y: auto; padding: 12px;
|
||||
display: flex; flex-direction: column; scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
.messages { display: flex; flex-direction: column; gap: 14px; flex: 1; }
|
||||
|
||||
/* ── Empty state ───────────────────────────────────────────── */
|
||||
.empty-state {
|
||||
display: flex; flex-direction: column; align-items: center;
|
||||
justify-content: center; flex: 1; gap: 10px;
|
||||
text-align: center; padding: 32px 16px; user-select: none;
|
||||
}
|
||||
.empty-state .ei { font-size: 34px; line-height: 1; }
|
||||
.empty-state p { font-size: 13px; line-height: 1.7; max-width: 230px; color: var(--fg2); }
|
||||
|
||||
/* ── Messages ──────────────────────────────────────────────── */
|
||||
.message {
|
||||
display: flex; flex-direction: column; max-width: 100%;
|
||||
animation: msgIn .15s ease-out;
|
||||
}
|
||||
@keyframes msgIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
|
||||
|
||||
.message.user { align-items: flex-end; }
|
||||
.message.assistant { align-items: flex-start; }
|
||||
|
||||
.msg-role {
|
||||
font-size: 9.5px; color: var(--fg3); margin-bottom: 3px; padding: 0 4px;
|
||||
font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
|
||||
}
|
||||
|
||||
.msg-body { display: flex; flex-direction: column; max-width: 92%; gap: 3px; }
|
||||
|
||||
.msg-bubble {
|
||||
padding: 8px 13px; border-radius: 14px;
|
||||
word-break: break-word; overflow-wrap: break-word;
|
||||
font-size: 13px; line-height: 1.65; white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.message.user .msg-bubble {
|
||||
background: var(--ububble); color: var(--ububble-text);
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
.message.assistant .msg-bubble {
|
||||
background: var(--abubble); color: var(--fg1);
|
||||
border: 1px solid var(--abubble-border);
|
||||
border-bottom-left-radius: 4px; white-space: normal;
|
||||
}
|
||||
|
||||
/* Streaming cursor */
|
||||
.msg-bubble.streaming::after {
|
||||
content: '\25AE'; display: inline-block; margin-left: 2px;
|
||||
color: var(--accent); animation: cblink .7s step-end infinite;
|
||||
}
|
||||
@keyframes cblink { 50% { opacity: 0; } }
|
||||
|
||||
/* Error bubble */
|
||||
.message.error .msg-bubble {
|
||||
background: rgba(239,68,68,.1);
|
||||
border: 1px solid rgba(239,68,68,.3); color: #fca5a5;
|
||||
}
|
||||
|
||||
/* Inline stream error note */
|
||||
.stream-err-note {
|
||||
margin-top: 6px; padding: 5px 9px;
|
||||
background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25);
|
||||
border-radius: 5px; color: #fca5a5; font-size: 11.5px;
|
||||
}
|
||||
|
||||
/* ── Thinking block ────────────────────────────────────────── */
|
||||
.think-block {
|
||||
border: 1px solid var(--think-border);
|
||||
background: var(--think-bg); border-radius: 8px;
|
||||
overflow: hidden; font-size: 12px; max-width: 100%;
|
||||
}
|
||||
.think-block summary {
|
||||
padding: 5px 10px; cursor: pointer; user-select: none;
|
||||
color: var(--think-text); font-weight: 500; font-size: 11.5px;
|
||||
list-style: none; display: flex; align-items: center; gap: 5px;
|
||||
}
|
||||
.think-block summary::-webkit-details-marker { display: none; }
|
||||
.think-block summary::before { content: '▶'; font-size: 9px; transition: transform .2s; }
|
||||
.think-block[open] summary::before { transform: rotate(90deg); }
|
||||
.think-content {
|
||||
padding: 8px 10px 9px; color: var(--think-text);
|
||||
border-top: 1px solid var(--think-border);
|
||||
max-height: 200px; overflow-y: auto;
|
||||
white-space: pre-wrap; word-break: break-word;
|
||||
font-size: 12px; line-height: 1.55;
|
||||
}
|
||||
|
||||
/* ── Message metadata ──────────────────────────────────────── */
|
||||
.msg-meta { display: flex; flex-direction: column; gap: 3px; }
|
||||
|
||||
.source-chip {
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
padding: 2px 8px; border-radius: 4px;
|
||||
background: var(--acc-dd); color: var(--accent);
|
||||
font-size: 11px; border: 1px solid rgba(124,58,237,.2);
|
||||
max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
||||
}
|
||||
|
||||
.metrics-line {
|
||||
font-size: 10.5px; color: var(--meta-text);
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
/* ── Bubble action buttons ─────────────────────────────────── */
|
||||
.msg-actions {
|
||||
display: flex; gap: 3px; padding: 1px 2px;
|
||||
opacity: 0; transition: opacity .15s;
|
||||
}
|
||||
.message:hover .msg-actions { opacity: 1; }
|
||||
.act-btn {
|
||||
background: var(--bg3); border: 1px solid var(--border);
|
||||
color: var(--fg2); padding: 2px 7px;
|
||||
border-radius: 4px; cursor: pointer; font-size: 11.5px;
|
||||
font-family: inherit; transition: background .12s, color .12s, border-color .12s;
|
||||
display: inline-flex; align-items: center; gap: 3px;
|
||||
}
|
||||
.act-btn:hover { background: var(--bg4); border-color: var(--accent); color: var(--fg1); }
|
||||
|
||||
/* Edit mode */
|
||||
.edit-textarea {
|
||||
width: 100%; background: var(--bg0); border: 1px solid var(--focus);
|
||||
color: var(--fg1); padding: 8px 10px; border-radius: 8px;
|
||||
font-size: 13px; font-family: inherit; resize: vertical;
|
||||
outline: none; min-height: 60px; max-height: 180px;
|
||||
}
|
||||
.edit-actions { display: flex; gap: 6px; margin-top: 5px; }
|
||||
.secondary-btn {
|
||||
background: var(--bg3); border: 1px solid var(--border);
|
||||
color: var(--fg2); padding: 5px 12px;
|
||||
border-radius: 6px; cursor: pointer; font-size: 12px; font-family: inherit;
|
||||
transition: background .12s;
|
||||
}
|
||||
.secondary-btn:hover { background: var(--bg4); color: var(--fg1); }
|
||||
|
||||
/* Code inside bubbles */
|
||||
.msg-bubble pre {
|
||||
background: var(--code-bg); border: 1px solid var(--bg3);
|
||||
border-radius: 6px; padding: 9px 11px;
|
||||
overflow-x: auto; margin: 6px 0; white-space: pre;
|
||||
}
|
||||
.msg-bubble code {
|
||||
font-family: 'Fira Code','Cascadia Code','Menlo','Consolas', monospace; font-size: 12px;
|
||||
}
|
||||
.msg-bubble pre code { background: none; padding: 0; font-size: 11.5px; line-height: 1.5; }
|
||||
.msg-bubble :not(pre) > code {
|
||||
background: rgba(0,0,0,.25); padding: 1px 5px; border-radius: 3px; font-size: 12px;
|
||||
}
|
||||
[data-theme="light"] .msg-bubble :not(pre) > code { background: rgba(0,0,0,.07); }
|
||||
.msg-bubble strong { font-weight: 600; }
|
||||
.msg-bubble em { font-style: italic; }
|
||||
|
||||
/* ── Input area ────────────────────────────────────────────── */
|
||||
.input-area {
|
||||
flex-shrink: 0; background: var(--bg1);
|
||||
border-top: 1px solid var(--border);
|
||||
padding: 8px 11px 11px;
|
||||
display: flex; flex-direction: column; gap: 6px;
|
||||
}
|
||||
|
||||
/* Collapsibles (system prompt, params) */
|
||||
.collapsible {
|
||||
background: var(--bg2); border: 1px solid var(--border);
|
||||
border-radius: 8px; overflow: hidden;
|
||||
}
|
||||
.collapsible.hidden { display: none; }
|
||||
.coll-hdr {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 5px 10px; background: var(--bg3);
|
||||
font-size: 11px; font-weight: 600; text-transform: uppercase;
|
||||
letter-spacing: .05em; color: var(--fg2);
|
||||
}
|
||||
|
||||
.collapsible textarea, #input-system-prompt {
|
||||
width: 100%; background: var(--bg2); border: none;
|
||||
color: var(--fg1); padding: 8px 10px;
|
||||
font-size: 13px; font-family: inherit; resize: none;
|
||||
outline: none; max-height: 100px; overflow-y: auto;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
/* Params grid */
|
||||
.params-grid {
|
||||
padding: 8px 10px; display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
gap: 5px 8px; align-items: center;
|
||||
}
|
||||
.param-lbl { font-size: 11.5px; color: var(--fg2); white-space: nowrap; }
|
||||
.param-input {
|
||||
width: 100%; background: var(--bg0); border: 1px solid var(--border);
|
||||
color: var(--fg1); padding: 3px 6px; border-radius: 5px;
|
||||
font-size: 12px; font-family: inherit; outline: none;
|
||||
}
|
||||
.param-input:focus { border-color: var(--focus); }
|
||||
.param-val { font-size: 11px; color: var(--fg3); text-align: right; min-width: 28px; }
|
||||
|
||||
/* File chips */
|
||||
.file-chips-area { display: flex; flex-wrap: wrap; gap: 5px; }
|
||||
.file-chips-area.hidden { display: none; }
|
||||
.file-chip {
|
||||
display: inline-flex; align-items: center; gap: 5px;
|
||||
background: var(--chip-bg); color: var(--chip-text);
|
||||
border: 1px solid var(--border); border-radius: 5px;
|
||||
padding: 3px 8px; font-size: 11.5px; max-width: 160px;
|
||||
}
|
||||
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
|
||||
.file-chip-del {
|
||||
background: none; border: none; cursor: pointer;
|
||||
color: var(--fg3); font-size: 11px; padding: 0 1px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.file-chip-del:hover { color: var(--err); }
|
||||
|
||||
/* Toolbar */
|
||||
.toolbar { display: flex; align-items: center; gap: 5px; }
|
||||
.tb-spacer { flex: 1; }
|
||||
.toolbar-btn {
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
background: var(--bg3); border: 1px solid var(--border);
|
||||
color: var(--fg2); padding: 4px 8px; border-radius: 5px;
|
||||
cursor: pointer; font-size: 11.5px; font-family: inherit;
|
||||
transition: border-color .12s, color .12s, background .12s;
|
||||
white-space: nowrap; max-width: 130px;
|
||||
}
|
||||
.toolbar-btn:hover { border-color: var(--accent); color: var(--fg1); }
|
||||
.toolbar-btn.active { background: var(--acc-d); border-color: var(--accent); color: var(--accent); }
|
||||
.tbi { font-size: 12px; flex-shrink: 0; line-height: 1; }
|
||||
|
||||
/* Page context label truncation */
|
||||
#page-ctx-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90px; }
|
||||
|
||||
/* Textarea */
|
||||
#input-message {
|
||||
width: 100%; background: var(--bg0); border: 1px solid var(--border);
|
||||
color: var(--fg1); padding: 8px 10px; border-radius: 8px;
|
||||
font-size: 13px; font-family: inherit; line-height: 1.5;
|
||||
resize: none; outline: none;
|
||||
min-height: 54px; max-height: 160px;
|
||||
transition: border-color .12s; overflow-y: auto; display: block;
|
||||
}
|
||||
#input-message:focus { border-color: var(--focus); }
|
||||
#input-message::placeholder { color: var(--fg3); opacity: .7; }
|
||||
#input-message:disabled { opacity: .5; cursor: not-allowed; }
|
||||
|
||||
/* Template dropdown */
|
||||
.tmpl-dropdown {
|
||||
background: var(--bg2); border: 1px solid var(--border);
|
||||
border-radius: 8px; overflow: hidden; z-index: 10;
|
||||
}
|
||||
.tmpl-dropdown.hidden { display: none; }
|
||||
.tmpl-dd-header {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 6px 10px; background: var(--bg3);
|
||||
font-size: 11px; font-weight: 600; text-transform: uppercase;
|
||||
letter-spacing: .05em; color: var(--fg2);
|
||||
}
|
||||
.tmpl-dd-list { max-height: 160px; overflow-y: auto; }
|
||||
.tmpl-dd-item {
|
||||
padding: 7px 11px; cursor: pointer;
|
||||
border-bottom: 1px solid var(--border);
|
||||
display: flex; flex-direction: column; gap: 2px;
|
||||
transition: background .1s;
|
||||
}
|
||||
.tmpl-dd-item:last-child { border-bottom: none; }
|
||||
.tmpl-dd-item:hover { background: var(--bg3); }
|
||||
.tmpl-dd-name { font-size: 12.5px; color: var(--fg1); font-weight: 500; }
|
||||
.tmpl-dd-preview { font-size: 11px; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
|
||||
/* Send row */
|
||||
.send-row { display: flex; gap: 6px; align-items: center; }
|
||||
|
||||
#select-model {
|
||||
flex: 1; min-width: 0;
|
||||
background: var(--bg0); border: 1px solid var(--border);
|
||||
color: var(--fg1); padding: 6px 24px 6px 8px;
|
||||
border-radius: 7px; font-size: 12px; font-family: inherit;
|
||||
outline: none; cursor: pointer;
|
||||
-webkit-appearance: none; appearance: none;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
|
||||
background-repeat: no-repeat; background-position: right 7px center;
|
||||
transition: border-color .12s;
|
||||
}
|
||||
#select-model:focus { border-color: var(--focus); }
|
||||
#select-model option { background: var(--bg2); color: var(--fg1); }
|
||||
|
||||
.send-btn {
|
||||
width: 34px; height: 34px; flex-shrink: 0;
|
||||
background: var(--accent); color: #fff; border: none;
|
||||
border-radius: 7px; cursor: pointer; font-size: 13px;
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
transition: background .12s, transform .1s;
|
||||
}
|
||||
.send-btn:hover { background: var(--acc-h); }
|
||||
.send-btn:active { transform: scale(.93); }
|
||||
.send-btn:disabled { background: var(--bg4); color: var(--fg3); cursor: not-allowed; transform: none; }
|
||||
|
||||
.stop-btn {
|
||||
width: 34px; height: 34px; flex-shrink: 0;
|
||||
background: var(--err); color: #fff; border: none;
|
||||
border-radius: 7px; cursor: pointer; font-size: 12px;
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
transition: background .12s;
|
||||
}
|
||||
.stop-btn:hover { background: #dc2626; }
|
||||
.stop-btn.hidden { display: none; }
|
||||
.send-btn.hidden { display: none; }
|
||||
|
||||
/* ── Template manager overlay ──────────────────────────────── */
|
||||
.overlay {
|
||||
position: absolute; inset: 0; z-index: 20;
|
||||
background: rgba(0,0,0,.55);
|
||||
display: flex; align-items: flex-start; justify-content: center;
|
||||
padding-top: 40px;
|
||||
}
|
||||
.overlay.hidden { display: none; }
|
||||
|
||||
.overlay-panel {
|
||||
background: var(--bg1); border: 1px solid var(--border);
|
||||
border-radius: 10px; width: calc(100% - 24px); max-width: 380px;
|
||||
display: flex; flex-direction: column; max-height: 80vh; overflow: hidden;
|
||||
}
|
||||
.overlay-hdr {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 10px 14px; border-bottom: 1px solid var(--border);
|
||||
font-weight: 600; font-size: 14px; flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tmpl-list {
|
||||
overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 0;
|
||||
}
|
||||
.tmpl-item {
|
||||
display: flex; align-items: flex-start; gap: 8px;
|
||||
padding: 9px 13px; border-bottom: 1px solid var(--border);
|
||||
transition: background .1s;
|
||||
}
|
||||
.tmpl-item:hover { background: var(--bg2); }
|
||||
.tmpl-item-body { flex: 1; min-width: 0; }
|
||||
.tmpl-item-name { font-size: 13px; font-weight: 500; color: var(--fg1); }
|
||||
.tmpl-item-text { font-size: 11.5px; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
|
||||
.tmpl-item-del {
|
||||
background: none; border: none; cursor: pointer;
|
||||
color: var(--fg3); font-size: 13px; padding: 2px 4px; flex-shrink: 0;
|
||||
}
|
||||
.tmpl-item-del:hover { color: var(--err); }
|
||||
|
||||
.tmpl-add-form {
|
||||
padding: 11px 13px; border-top: 1px solid var(--border);
|
||||
display: flex; flex-direction: column; gap: 7px; flex-shrink: 0;
|
||||
}
|
||||
.tmpl-add-form input, .tmpl-add-form textarea {
|
||||
background: var(--bg0); border: 1px solid var(--border);
|
||||
color: var(--fg1); padding: 7px 9px; border-radius: 6px;
|
||||
font-size: 13px; font-family: inherit; outline: none;
|
||||
}
|
||||
.tmpl-add-form input:focus, .tmpl-add-form textarea:focus { border-color: var(--focus); }
|
||||
.tmpl-add-form textarea { resize: vertical; min-height: 70px; }
|
||||
|
||||
/* ── Relative positioning for overlay ─────────────────────── */
|
||||
#app { position: relative; }
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ollama Sidebar</title>
|
||||
<link rel="stylesheet" href="sidepanel.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-theme="dark">
|
||||
|
||||
<!-- ── Header ─────────────────────────────────────────────── -->
|
||||
<header>
|
||||
<div class="h-left">
|
||||
<button id="btn-sessions" class="icon-btn" title="Conversations">☰</button>
|
||||
<span class="app-title">Ollama</span>
|
||||
<span id="status-dot" class="status-dot" title="Checking…"></span>
|
||||
</div>
|
||||
<div class="h-right">
|
||||
<button id="btn-theme" class="icon-btn" title="Toggle theme">◐</button>
|
||||
<button id="btn-settings" class="icon-btn" title="Settings">⚙</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- ── Settings panel ─────────────────────────────────────── -->
|
||||
<div id="settings-panel" class="drop-panel hidden">
|
||||
<div class="field-group">
|
||||
<label class="field-lbl">Ollama URL</label>
|
||||
<input type="text" id="input-url" placeholder="http://localhost:11434" spellcheck="false">
|
||||
</div>
|
||||
<div class="field-group">
|
||||
<label class="field-lbl">Bearer Token <span class="hint">(optional)</span></label>
|
||||
<div class="input-row-inline">
|
||||
<input type="password" id="input-token" placeholder="Leave empty if not required" spellcheck="false">
|
||||
<button id="btn-show-token" class="icon-btn sm" title="Show/hide">⚬</button>
|
||||
</div>
|
||||
</div>
|
||||
<button id="btn-save" class="primary-btn">Save & Connect</button>
|
||||
<div id="settings-status" class="status-line"></div>
|
||||
|
||||
<!-- System prompt -->
|
||||
<div id="system-prompt-panel" class="collapsible">
|
||||
<div class="coll-hdr">
|
||||
<span>System Prompt</span>
|
||||
<button id="btn-close-system" class="icon-btn sm">✕</button>
|
||||
</div>
|
||||
<textarea id="input-system-prompt"
|
||||
placeholder="Instructions for the model this session…"
|
||||
rows="3"
|
||||
spellcheck="true"></textarea>
|
||||
</div>
|
||||
|
||||
<!-- Model parameters -->
|
||||
<div id="params-panel" class="collapsible">
|
||||
<div class="coll-hdr">
|
||||
<span>Parameters</span>
|
||||
<button id="btn-close-params" class="icon-btn sm">✕</button>
|
||||
</div>
|
||||
<div id="params-grid" class="params-grid"></div>
|
||||
</div>
|
||||
|
||||
<!-- Model selector -->
|
||||
<div class="field-group">
|
||||
<label class="field-lbl">Model</label>
|
||||
<select id="select-model"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Sessions panel ─────────────────────────────────────── -->
|
||||
<div id="sessions-panel" class="drop-panel hidden">
|
||||
<div class="panel-hdr">
|
||||
<span class="panel-title">Conversations</span>
|
||||
<button id="btn-new-session" class="pill-btn">+ New</button>
|
||||
</div>
|
||||
<div id="sessions-list" class="sessions-list"></div>
|
||||
</div>
|
||||
|
||||
<!-- ── Session bar ─────────────────────────────────────────── -->
|
||||
<div class="session-bar">
|
||||
<span id="session-name-display" class="session-name" title="Click to rename" id="session-name-display"></span>
|
||||
<div class="session-bar-actions">
|
||||
<button id="btn-rename-session" class="icon-btn sm" title="Rename">✎</button>
|
||||
<button id="btn-export-session" class="icon-btn sm" title="Export as Markdown">⇓</button>
|
||||
<button id="btn-delete-session" class="icon-btn sm danger" title="Delete session">✕</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Chat area ───────────────────────────────────────────── -->
|
||||
<div id="chat-area" class="chat-area">
|
||||
<div id="messages" class="messages"></div>
|
||||
</div>
|
||||
|
||||
<!-- ── Input area ──────────────────────────────────────────── -->
|
||||
<div class="input-area">
|
||||
|
||||
<!-- File chips -->
|
||||
<div id="file-chips-area" class="file-chips-area hidden">
|
||||
<div id="file-chips" class="file-chips"></div>
|
||||
</div>
|
||||
|
||||
<!-- Toolbar -->
|
||||
<div class="toolbar">
|
||||
<button id="btn-page-context" class="toolbar-btn" title="Toggle page context">
|
||||
<span class="tbi">▢</span><span id="page-ctx-lbl">Page</span>
|
||||
</button>
|
||||
<button id="btn-attach-file" class="toolbar-btn" title="Attach file (.txt .md .pdf .csv)">
|
||||
<span class="tbi">📎</span>
|
||||
</button>
|
||||
<button id="btn-templates-open" class="toolbar-btn" title="Prompt templates">
|
||||
<span class="tbi">/</span>
|
||||
</button>
|
||||
<div class="tb-spacer"></div>
|
||||
<button id="btn-clear" class="toolbar-btn" title="Clear conversation">
|
||||
<span class="tbi">✕</span> Clear
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Message input -->
|
||||
<textarea id="input-message"
|
||||
placeholder="Type a message… (Enter to send, Shift+Enter for newline, / for templates)"
|
||||
rows="3"
|
||||
spellcheck="true"></textarea>
|
||||
|
||||
<!-- Template autocomplete dropdown (shown when / is typed) -->
|
||||
<div id="template-dropdown" class="tmpl-dropdown hidden">
|
||||
<div class="tmpl-dd-header">
|
||||
Templates
|
||||
<button id="btn-tmpl-manage-inline" class="pill-btn">Manage</button>
|
||||
</div>
|
||||
<div id="tmpl-dd-list" class="tmpl-dd-list"></div>
|
||||
</div>
|
||||
|
||||
<!-- Send row -->
|
||||
<div class="send-row">
|
||||
<button id="btn-stop" class="stop-btn hidden" title="Stop generation">■</button>
|
||||
<span id="model-display" class="model-display" title="Active model"></span>
|
||||
<button id="btn-send" class="send-btn" title="Send (Enter)">►</button>
|
||||
</div>
|
||||
|
||||
</div><!-- /input-area -->
|
||||
|
||||
<!-- ── Template manager overlay ───────────────────────────── -->
|
||||
<div id="tmpl-overlay" class="overlay hidden">
|
||||
<div class="overlay-panel">
|
||||
<div class="overlay-hdr">
|
||||
<span>Prompt Templates</span>
|
||||
<button id="btn-tmpl-overlay-close" class="icon-btn">✕</button>
|
||||
</div>
|
||||
<div id="tmpl-list" class="tmpl-list"></div>
|
||||
<div class="tmpl-add-form">
|
||||
<input id="tmpl-new-name" type="text" placeholder="Template name…" maxlength="60">
|
||||
<textarea id="tmpl-new-content" placeholder="Template content…" rows="4"></textarea>
|
||||
<button id="btn-tmpl-add" class="primary-btn">Add Template</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Hidden file input -->
|
||||
<input type="file" id="file-input" accept=".txt,.md,.pdf,.csv" multiple hidden>
|
||||
|
||||
</div><!-- /#app -->
|
||||
<!-- Markdown renderer -->
|
||||
<script src="marked.min.js"></script>
|
||||
<script src="highlight.min.js"></script>
|
||||
<script src="sidepanel.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+1535
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user