Add settings page, model management, and chat UX improvements
- Settings infrastructure: key-value settings table, GET/PUT API, Pinia store - Configurable assistant name (default "Fable") in settings and LLM system prompt - Model catalog with 18 models in 3 categories (General Purpose, Coding, Uncensored / Creative Writing) with download/select/remove functionality - Move Ollama status indicator from chat views to global nav bar - Chat bubble layout: user messages right-aligned, assistant left-aligned - Floating dark input bar with auto-focus and circular send button - Fix HTML entity rendering (' apostrophe issue in marked/DOMPurify pipeline) - Fix new chat button navigation (fetchConversation before router.push) - Recent chats section on home page with "New Chat" button - Update summary.md with Phase 4.5 changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch, nextTick, onMounted, onUnmounted } from "vue";
|
||||
import { ref, computed, watch, nextTick } from "vue";
|
||||
import { useChatStore } from "@/stores/chat";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
import { renderMarkdown } from "@/utils/markdown";
|
||||
import ChatMessage from "@/components/ChatMessage.vue";
|
||||
|
||||
@@ -13,6 +14,7 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
const store = useChatStore();
|
||||
const settingsStore = useSettingsStore();
|
||||
const messageInput = ref("");
|
||||
const messagesEl = ref<HTMLElement | null>(null);
|
||||
|
||||
@@ -26,20 +28,6 @@ watch(
|
||||
() => scrollToBottom()
|
||||
);
|
||||
|
||||
const statusLabel = computed(() => {
|
||||
if (store.ollamaStatus === "unavailable") return "Unavailable";
|
||||
if (store.modelStatus === "not_found") return "Downloading...";
|
||||
if (store.chatReady) return "Connected";
|
||||
return "Checking...";
|
||||
});
|
||||
|
||||
const statusClass = computed(() => {
|
||||
if (store.ollamaStatus === "unavailable") return "status-red";
|
||||
if (store.modelStatus === "not_found") return "status-yellow";
|
||||
if (store.chatReady) return "status-green";
|
||||
return "status-yellow";
|
||||
});
|
||||
|
||||
function scrollToBottom() {
|
||||
nextTick(() => {
|
||||
if (messagesEl.value) {
|
||||
@@ -48,14 +36,6 @@ function scrollToBottom() {
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
store.startStatusPolling();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
store.stopStatusPolling();
|
||||
});
|
||||
|
||||
async function sendMessage() {
|
||||
const content = messageInput.value.trim();
|
||||
if (!content || store.streaming) return;
|
||||
@@ -96,10 +76,6 @@ function onInputKeydown(e: KeyboardEvent) {
|
||||
<aside class="chat-panel">
|
||||
<div class="panel-header">
|
||||
<h3>Chat</h3>
|
||||
<span class="status-indicator" :class="statusClass">
|
||||
<span class="status-dot"></span>
|
||||
{{ statusLabel }}
|
||||
</span>
|
||||
<span v-if="contextNoteId" class="context-indicator">
|
||||
Note #{{ contextNoteId }}
|
||||
</span>
|
||||
@@ -115,13 +91,18 @@ function onInputKeydown(e: KeyboardEvent) {
|
||||
@save-as-note="handleSaveAsNote"
|
||||
/>
|
||||
</template>
|
||||
<div v-if="store.streaming" class="chat-message role-assistant streaming">
|
||||
<div class="message-header">
|
||||
<span class="role-label">Assistant</span>
|
||||
|
||||
<!-- Streaming bubble -->
|
||||
<div v-if="store.streaming" class="chat-message role-assistant">
|
||||
<div class="streaming-bubble">
|
||||
<div class="message-header">
|
||||
<span class="role-label">{{ settingsStore.assistantName }}</span>
|
||||
</div>
|
||||
<div class="message-content prose" v-html="streamingRendered"></div>
|
||||
<span class="typing-indicator"></span>
|
||||
</div>
|
||||
<div class="message-content prose" v-html="streamingRendered"></div>
|
||||
<span class="typing-indicator"></span>
|
||||
</div>
|
||||
|
||||
<p
|
||||
v-if="!store.currentConversation?.messages.length && !store.streaming"
|
||||
class="empty-msg"
|
||||
@@ -134,7 +115,7 @@ function onInputKeydown(e: KeyboardEvent) {
|
||||
<textarea
|
||||
v-model="messageInput"
|
||||
@keydown="onInputKeydown"
|
||||
:placeholder="store.chatReady ? 'Type a message...' : statusLabel"
|
||||
:placeholder="store.chatReady ? 'Type a message...' : 'Chat unavailable'"
|
||||
:disabled="store.streaming || !store.chatReady"
|
||||
rows="2"
|
||||
></textarea>
|
||||
@@ -143,7 +124,7 @@ function onInputKeydown(e: KeyboardEvent) {
|
||||
@click="sendMessage"
|
||||
:disabled="!messageInput.trim() || store.streaming || !store.chatReady"
|
||||
>
|
||||
Send
|
||||
↑
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -182,35 +163,6 @@ function onInputKeydown(e: KeyboardEvent) {
|
||||
font-size: 1rem;
|
||||
flex: 1;
|
||||
}
|
||||
.status-indicator {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-text-muted);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.status-dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.status-green .status-dot {
|
||||
background: #22c55e;
|
||||
}
|
||||
.status-yellow .status-dot {
|
||||
background: #eab308;
|
||||
animation: pulse-dot 2s infinite;
|
||||
}
|
||||
.status-red .status-dot {
|
||||
background: #ef4444;
|
||||
}
|
||||
@keyframes pulse-dot {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.4; }
|
||||
}
|
||||
|
||||
.context-indicator {
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-primary);
|
||||
@@ -237,27 +189,37 @@ function onInputKeydown(e: KeyboardEvent) {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.streaming {
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 8px;
|
||||
padding: 0.75rem 1rem;
|
||||
background: var(--color-bg-card);
|
||||
margin-bottom: 0.5rem;
|
||||
/* Streaming bubble — matches ChatMessage assistant style */
|
||||
.chat-message {
|
||||
display: flex;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
.streaming .message-header {
|
||||
.role-assistant {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.streaming-bubble {
|
||||
max-width: 90%;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 16px;
|
||||
border-bottom-left-radius: 4px;
|
||||
background: var(--color-bg-card);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
.streaming-bubble .message-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
.streaming .role-label {
|
||||
font-size: 0.8rem;
|
||||
.streaming-bubble .role-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
.streaming .message-content {
|
||||
.streaming-bubble .message-content {
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.5;
|
||||
line-height: 1.55;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -276,40 +238,52 @@ function onInputKeydown(e: KeyboardEvent) {
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
|
||||
/* Dark floating input */
|
||||
.panel-input {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem;
|
||||
border-top: 1px solid var(--color-border);
|
||||
background: var(--color-bg-secondary);
|
||||
margin: 0 0.5rem 0.5rem;
|
||||
padding: 0.5rem 0.5rem 0.5rem 0.75rem;
|
||||
background: #1c1c1e;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.panel-input textarea {
|
||||
flex: 1;
|
||||
resize: none;
|
||||
padding: 0.5rem;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 6px;
|
||||
padding: 0.35rem 0.5rem;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
font-family: inherit;
|
||||
font-size: 0.9rem;
|
||||
background: var(--color-bg);
|
||||
color: var(--color-text);
|
||||
}
|
||||
.panel-input textarea:focus {
|
||||
background: transparent;
|
||||
color: #fff;
|
||||
outline: none;
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
.panel-input textarea::placeholder {
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
}
|
||||
.panel-input textarea:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.btn-send {
|
||||
padding: 0.5rem 1rem;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--color-primary);
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
font-size: 0.85rem;
|
||||
align-self: flex-end;
|
||||
font-size: 1rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.btn-send:disabled {
|
||||
opacity: 0.5;
|
||||
opacity: 0.35;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user