Refactor: Rename all database references to Knowledge across backend and frontend services, updating endpoints, workflows, and UI terminology.
This commit is contained in:
@@ -1130,7 +1130,7 @@ export default function App() {
|
||||
setKnowledgeSaveTarget(null)
|
||||
await refreshLibraries()
|
||||
await refreshLibraryJobs()
|
||||
showKnowledgeSaveToast(result?.already_saved ? 'This message is already saved in that database.' : 'Message saved to knowledge.')
|
||||
showKnowledgeSaveToast(result?.already_saved ? 'This message is already saved in Knowledge.' : 'Message saved to Knowledge.')
|
||||
}
|
||||
|
||||
function openChatMessageSource(item) {
|
||||
@@ -1431,7 +1431,7 @@ async function createNewChat() {
|
||||
className={`sidebar-tab ${activeSidebarMode === 'dbs' ? 'active' : ''}`}
|
||||
onClick={() => handleSidebarClick('dbs')}
|
||||
>
|
||||
DBs
|
||||
Knowledge
|
||||
</div>
|
||||
<div
|
||||
className={`sidebar-tab ${activeSidebarMode === 'workflows' ? 'active' : ''}`}
|
||||
|
||||
@@ -560,7 +560,7 @@ export default function GeneralSettings({
|
||||
|
||||
const handlePurgeLibraries = async () => {
|
||||
const confirmed = window.confirm(
|
||||
'Delete all Heimgeist databases, staged files, and indexes from local storage? Chat history will be kept.'
|
||||
'Delete Heimgeist Knowledge, staged files, and indexes from local storage? Chat history will be kept.'
|
||||
);
|
||||
if (!confirmed) {
|
||||
return;
|
||||
@@ -570,7 +570,7 @@ export default function GeneralSettings({
|
||||
setLibraryPurgeStatus({ tone: 'neutral', message: '' });
|
||||
|
||||
try {
|
||||
const response = await fetch(`${backendApiUrl}/libraries/purge`, {
|
||||
const response = await fetch(`${backendApiUrl}/knowledge/purge`, {
|
||||
method: 'POST',
|
||||
});
|
||||
const data = await response.json().catch(() => null);
|
||||
@@ -583,8 +583,8 @@ export default function GeneralSettings({
|
||||
setLibraryPurgeStatus({
|
||||
tone: 'success',
|
||||
message: count > 0
|
||||
? `Removed ${count} database${count === 1 ? '' : 's'} from local storage.`
|
||||
: 'No local databases were found to remove.',
|
||||
? 'Removed local Knowledge data from storage.'
|
||||
: 'No local Knowledge data was found to remove.',
|
||||
});
|
||||
|
||||
if (onLibrariesPurged) {
|
||||
@@ -593,7 +593,7 @@ export default function GeneralSettings({
|
||||
} catch (error) {
|
||||
setLibraryPurgeStatus({
|
||||
tone: 'error',
|
||||
message: `Database purge failed: ${error.message || String(error)}`,
|
||||
message: `Knowledge purge failed: ${error.message || String(error)}`,
|
||||
});
|
||||
} finally {
|
||||
setIsPurgingLibraries(false);
|
||||
@@ -693,7 +693,7 @@ export default function GeneralSettings({
|
||||
))}
|
||||
</select>
|
||||
<p className="setting-description">
|
||||
Heimgeist uses this model for building or rebuilding local database embeddings.
|
||||
Heimgeist uses this model for building or rebuilding local Knowledge embeddings.
|
||||
</p>
|
||||
</div>
|
||||
<div className="setting-section">
|
||||
@@ -917,7 +917,7 @@ export default function GeneralSettings({
|
||||
</p>
|
||||
</div>
|
||||
<div className="setting-section danger-zone">
|
||||
<h3>Purge Databases</h3>
|
||||
<h3>Purge Knowledge</h3>
|
||||
<div className="setting-control-row">
|
||||
<button
|
||||
type="button"
|
||||
@@ -925,11 +925,11 @@ export default function GeneralSettings({
|
||||
onClick={handlePurgeLibraries}
|
||||
disabled={isPurgingLibraries || !backendApiUrl}
|
||||
>
|
||||
{isPurgingLibraries ? 'Purging...' : 'Delete All Databases'}
|
||||
{isPurgingLibraries ? 'Purging...' : 'Delete Knowledge'}
|
||||
</button>
|
||||
</div>
|
||||
<p className="setting-description">
|
||||
Removes every local Heimgeist database, including staged files, corpora, and indexes. This is meant as a recovery action when the DB panel becomes unusable. Chat history stays intact.
|
||||
Removes local Heimgeist Knowledge, including staged files, corpora, and indexes. This is meant as a recovery action when the Knowledge panel becomes unusable. Chat history stays intact.
|
||||
</p>
|
||||
{libraryPurgeStatus.message && (
|
||||
<p className={`setting-status ${libraryPurgeStatus.tone}`}>
|
||||
|
||||
@@ -40,7 +40,7 @@ function itemSyncMeta(item) {
|
||||
status,
|
||||
progress,
|
||||
label: progress > 0 ? `Syncing ${Math.round(progress)}%` : 'Syncing',
|
||||
detail: detail || 'Rebuilding the database search indexes.'
|
||||
detail: detail || 'Rebuilding Knowledge search indexes.'
|
||||
}
|
||||
}
|
||||
return {
|
||||
@@ -145,7 +145,7 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
if (contentPreviews[itemId]) return
|
||||
setContentPreviews(current => ({ ...current, [itemId]: { loading: true } }))
|
||||
try {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/items/${itemId}`)
|
||||
const response = await fetch(`${apiBase}/knowledge/items/${itemId}`)
|
||||
const data = await expectJson(response)
|
||||
setContentPreviews(current => ({ ...current, [itemId]: { data } }))
|
||||
} catch (error) {
|
||||
@@ -178,13 +178,13 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
if (!Array.isArray(paths) || paths.length === 0) return
|
||||
try {
|
||||
await runAction(async () => {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/files/register`, {
|
||||
const response = await fetch(`${apiBase}/knowledge/files/register`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ paths })
|
||||
})
|
||||
return expectJson(response)
|
||||
}, 'Files added. Heimgeist is updating the database.')
|
||||
}, 'Files added. Heimgeist is updating Knowledge.')
|
||||
} catch {}
|
||||
}
|
||||
|
||||
@@ -196,8 +196,8 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
const editing = Boolean(editingItemId)
|
||||
const response = await fetch(
|
||||
editing
|
||||
? `${apiBase}/libraries/${library.slug}/texts/${editingItemId}`
|
||||
: `${apiBase}/libraries/${library.slug}/texts`,
|
||||
? `${apiBase}/knowledge/texts/${editingItemId}`
|
||||
: `${apiBase}/knowledge/texts`,
|
||||
{
|
||||
method: editing ? 'PATCH' : 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
@@ -205,7 +205,7 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
}
|
||||
)
|
||||
return expectJson(response)
|
||||
}, editingItemId ? 'Text updated.' : 'Text added to the database.')
|
||||
}, editingItemId ? 'Text updated.' : 'Text added to Knowledge.')
|
||||
if (editingItemId) {
|
||||
setContentPreviews(current => {
|
||||
const next = { ...current }
|
||||
@@ -223,7 +223,7 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
setBusy(true)
|
||||
setErrorMessage('')
|
||||
try {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/items/${item.item_id}`)
|
||||
const response = await fetch(`${apiBase}/knowledge/items/${item.item_id}`)
|
||||
const data = await expectJson(response)
|
||||
setEditingItemId(item.item_id)
|
||||
setTextTitle(data.title || item.title || item.name || '')
|
||||
@@ -242,7 +242,7 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
setWebsiteProcessing(true)
|
||||
try {
|
||||
const result = await runAction(async () => {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/websites`, {
|
||||
const response = await fetch(`${apiBase}/knowledge/websites`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ url: websiteUrl, title: websiteTitle || null })
|
||||
@@ -266,7 +266,7 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
if (!library || !item?.item_id) return
|
||||
try {
|
||||
const result = await runAction(async () => {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/websites/${item.item_id}/refresh`, {
|
||||
const response = await fetch(`${apiBase}/knowledge/websites/${item.item_id}/refresh`, {
|
||||
method: 'POST'
|
||||
})
|
||||
return expectJson(response)
|
||||
@@ -286,7 +286,7 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
setWebsiteProcessing(true)
|
||||
try {
|
||||
const result = await runAction(async () => {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/videos/${item.item_id}/refresh`, {
|
||||
const response = await fetch(`${apiBase}/knowledge/videos/${item.item_id}/refresh`, {
|
||||
method: 'POST'
|
||||
})
|
||||
return expectJson(response)
|
||||
@@ -308,7 +308,7 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
if (!library) return
|
||||
try {
|
||||
await runAction(async () => {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/files`, {
|
||||
const response = await fetch(`${apiBase}/knowledge/files`, {
|
||||
method: 'DELETE',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ rel: item.rel })
|
||||
@@ -322,7 +322,7 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
if (!library) return
|
||||
try {
|
||||
await runAction(async () => {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/files/enrichment`, {
|
||||
const response = await fetch(`${apiBase}/knowledge/files/enrichment`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ rel: item.rel, enabled })
|
||||
@@ -336,9 +336,9 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
if (!library) return
|
||||
try {
|
||||
await runAction(async () => {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/jobs/prepare`, { method: 'POST' })
|
||||
const response = await fetch(`${apiBase}/knowledge/jobs/prepare`, { method: 'POST' })
|
||||
return expectJson(response)
|
||||
}, 'Generating metadata for this database.')
|
||||
}, 'Generating metadata for Knowledge.')
|
||||
} catch {}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
if (!library) return
|
||||
try {
|
||||
await runAction(async () => {
|
||||
const response = await fetch(`${apiBase}/libraries/${library.slug}/jobs/prepare`, { method: 'POST' })
|
||||
const response = await fetch(`${apiBase}/knowledge/jobs/prepare`, { method: 'POST' })
|
||||
return expectJson(response)
|
||||
})
|
||||
} catch {}
|
||||
@@ -400,16 +400,16 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
return
|
||||
}
|
||||
if (!previousState.isSyncing && nextState.isSyncing) {
|
||||
queueToast('Syncing this database. Heimgeist is rebuilding its search indexes.')
|
||||
queueToast('Syncing Knowledge. Heimgeist is rebuilding its search indexes.')
|
||||
} else if (previousState.isSyncing && !nextState.isSyncing) {
|
||||
if (nextState.hasFailedItems) queueToast('Some content did not finish syncing.', 'warning')
|
||||
else if (nextState.isReadyForChat) queueToast('Sync complete. This database is ready in chat.', 'success')
|
||||
else if (nextState.isReadyForChat) queueToast('Sync complete. Knowledge is ready in chat.', 'success')
|
||||
}
|
||||
previousLibraryStateRef.current = nextState
|
||||
}, [library?.slug, items.length, hasFailedItems, isReadyForChat, isSyncing])
|
||||
|
||||
if (!library) {
|
||||
return <div className="placeholder-view"><p>Create a database, then add files, your own texts, or websites.</p></div>
|
||||
return <div className="placeholder-view"><p>Add files, your own texts, or websites to Knowledge.</p></div>
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -465,14 +465,14 @@ export default function LibraryManager({ apiBase, library, jobs, onOpenChatMessa
|
||||
<div className="library-content-heading">
|
||||
<div>
|
||||
<h2>Contents</h2>
|
||||
<p className="muted-copy">Files, texts, website snapshots, videos, and saved chat messages are searched together when this database is selected.</p>
|
||||
<p className="muted-copy">Files, texts, website snapshots, videos, and saved chat messages are searched together through Knowledge workflows.</p>
|
||||
</div>
|
||||
<input
|
||||
className="library-search"
|
||||
value={search}
|
||||
onChange={event => setSearch(event.target.value)}
|
||||
placeholder="Search contents"
|
||||
aria-label="Search database contents"
|
||||
aria-label="Search Knowledge contents"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useMemo, useState } from 'react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { splitThinkBlocks } from './chatText'
|
||||
|
||||
function cleanAssistantContent(content) {
|
||||
@@ -46,18 +46,11 @@ async function expectJson(response) {
|
||||
|
||||
export default function SaveMessageToKnowledgeDialog({
|
||||
apiBase,
|
||||
defaultLibrarySlug,
|
||||
libraries,
|
||||
message,
|
||||
onClose,
|
||||
onSaved,
|
||||
precedingUserMessage,
|
||||
}) {
|
||||
const initialLibrarySlug = useMemo(() => {
|
||||
if (libraries.some(library => library.slug === defaultLibrarySlug)) return defaultLibrarySlug
|
||||
return libraries[0]?.slug || ''
|
||||
}, [defaultLibrarySlug, libraries])
|
||||
const [librarySlug, setLibrarySlug] = useState(initialLibrarySlug)
|
||||
const [title, setTitle] = useState(() => defaultTitle(message))
|
||||
const [content, setContent] = useState(() => defaultKnowledgeContent(message, precedingUserMessage))
|
||||
const [busy, setBusy] = useState(false)
|
||||
@@ -73,11 +66,11 @@ export default function SaveMessageToKnowledgeDialog({
|
||||
|
||||
async function submit(event) {
|
||||
event.preventDefault()
|
||||
if (!librarySlug || !message?.message_id) return
|
||||
if (!message?.message_id) return
|
||||
setBusy(true)
|
||||
setError('')
|
||||
try {
|
||||
const response = await fetch(`${apiBase}/libraries/${librarySlug}/chat-messages`, {
|
||||
const response = await fetch(`${apiBase}/knowledge/chat-messages`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
@@ -103,39 +96,27 @@ export default function SaveMessageToKnowledgeDialog({
|
||||
<div className="knowledge-save-header">
|
||||
<div>
|
||||
<strong id="knowledge-save-title">Save message to knowledge</strong>
|
||||
<p>The saved snapshot becomes a normal RAG item in the selected database.</p>
|
||||
<p>The saved snapshot becomes a normal item in Knowledge.</p>
|
||||
</div>
|
||||
<button type="button" className="icon-button" title="Close" aria-label="Close" onClick={onClose} disabled={busy}>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M18 6 6 18M6 6l12 12" /></svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{libraries.length === 0 ? (
|
||||
<div className="form-error">Create a database before saving chat knowledge.</div>
|
||||
) : (
|
||||
<>
|
||||
<label>
|
||||
Database
|
||||
<select value={librarySlug} onChange={event => setLibrarySlug(event.target.value)} disabled={busy}>
|
||||
{libraries.map(library => <option key={library.slug} value={library.slug}>{library.name}</option>)}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Title
|
||||
<input value={title} onChange={event => setTitle(event.target.value)} required autoFocus disabled={busy} />
|
||||
</label>
|
||||
<label>
|
||||
Knowledge content
|
||||
<textarea value={content} onChange={event => setContent(event.target.value)} rows={12} required disabled={busy} />
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
<label>
|
||||
Title
|
||||
<input value={title} onChange={event => setTitle(event.target.value)} required autoFocus disabled={busy} />
|
||||
</label>
|
||||
<label>
|
||||
Knowledge content
|
||||
<textarea value={content} onChange={event => setContent(event.target.value)} rows={12} required disabled={busy} />
|
||||
</label>
|
||||
|
||||
{error && <div className="form-error">{error}</div>}
|
||||
<div className="knowledge-save-actions">
|
||||
<button type="button" className="button ghost" onClick={onClose} disabled={busy}>Cancel</button>
|
||||
<button type="submit" className="button" disabled={busy || libraries.length === 0 || !librarySlug || !title.trim() || !content.trim()}>
|
||||
{busy ? 'Saving...' : 'Save to Database'}
|
||||
<button type="submit" className="button" disabled={busy || !title.trim() || !content.trim()}>
|
||||
{busy ? 'Saving...' : 'Save to Knowledge'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user