feat(webchat): add slash commands, autocomplete popup, and web search button
Add 6 slash commands (/help, /reset, /compact, /usage, /status, /model) with autocomplete popup (arrow keys, Enter/Tab/Escape navigation). Search button toggles web search mode by prepending instruction to message. Backend agent.send extended with metadata for server-side command routing.
This commit is contained in:
@@ -529,6 +529,30 @@ header #status.status-ok {
|
||||
.card .value {
|
||||
font-size: var(--font-size-lg);
|
||||
}
|
||||
|
||||
.chat-layout {
|
||||
height: calc(100vh - 32px);
|
||||
}
|
||||
|
||||
.chat-header {
|
||||
padding-bottom: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.btn-action {
|
||||
font-size: 11px;
|
||||
padding: 6px 8px;
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
.slash-popup-item {
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.slash-popup-item .cmd-name {
|
||||
min-width: 70px;
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
@@ -904,6 +928,117 @@ tr:hover td {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Chat actions bar (search button, etc.) */
|
||||
.chat-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.btn-action {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 12px;
|
||||
border-radius: 16px;
|
||||
background: var(--bg-tertiary);
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid var(--border);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-sm);
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
user-select: none;
|
||||
transition: all var(--transition);
|
||||
}
|
||||
|
||||
.btn-action:hover {
|
||||
color: var(--text-primary);
|
||||
border-color: var(--text-muted);
|
||||
background: var(--bg-secondary);
|
||||
}
|
||||
|
||||
.btn-action.active {
|
||||
background: var(--accent-muted);
|
||||
color: var(--accent);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.btn-action svg {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
flex-shrink: 0;
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
/* Slash command autocomplete popup */
|
||||
.chat-input-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.slash-popup {
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin-bottom: 4px;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
max-height: 240px;
|
||||
overflow-y: auto;
|
||||
z-index: 100;
|
||||
box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.slash-popup-item {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
transition: background var(--transition);
|
||||
}
|
||||
|
||||
.slash-popup-item:hover,
|
||||
.slash-popup-item.selected {
|
||||
background: var(--bg-tertiary);
|
||||
}
|
||||
|
||||
.slash-popup-item .cmd-name {
|
||||
color: var(--accent);
|
||||
font-weight: 600;
|
||||
font-size: var(--font-size-base);
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.slash-popup-item .cmd-desc {
|
||||
color: var(--text-muted);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
/* System messages */
|
||||
.message.system {
|
||||
align-self: stretch;
|
||||
max-width: 100%;
|
||||
background: var(--bg-tertiary);
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid var(--border-light);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.message.system strong {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.message.system code {
|
||||
color: var(--accent);
|
||||
background: var(--bg-secondary);
|
||||
padding: 1px 4px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* Streaming text cursor */
|
||||
.streaming-cursor::after {
|
||||
content: '|';
|
||||
@@ -1212,4 +1347,27 @@ tr:hover td {
|
||||
.stats-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.chat-header {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.chat-header select {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.chat-actions {
|
||||
padding: 6px 0;
|
||||
}
|
||||
|
||||
.btn-action {
|
||||
padding: 8px 10px;
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
.slash-popup {
|
||||
max-height: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user