Skip to content

Commit caf5fb7

Browse files
Remove package.json and update dependencies in pyproject.toml; add new API routes and components for knowledge and memory management. Introduce new Vue pages for knowledge and memory, enhancing the application's functionality and user experience.
1 parent fe46f60 commit caf5fb7

17 files changed

Lines changed: 3475 additions & 13 deletions

package.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.12"
77
dependencies = [
8-
"agno[scheduler]>=2.5.14",
8+
"agno[scheduler]>=2.5.17",
99
"aiosqlite>=0.22.1",
1010
"anthropic>=0.89.0",
1111
"arxiv>=2.4.1",
@@ -15,6 +15,7 @@ dependencies = [
1515
"crawl4ai>=0.8.6",
1616
"ddgs>=9.12.0",
1717
"docker>=7.1.0",
18+
"docling>=2.88.0",
1819
"fastapi[standard]>=0.135.1",
1920
"greenlet>=3.3.2",
2021
"httpx>=0.28.1",
@@ -27,7 +28,7 @@ dependencies = [
2728
"pyyaml>=6.0.2",
2829
"requests>=2.32.5",
2930
"sqlalchemy>=2.0.48",
30-
"typer>=0.24.1",
31+
"typer>=0.21.2",
3132
"websockets>=12",
3233
"wikipedia>=1.4.0",
3334
"youtube-transcript-api>=1.2.4",

web/components.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ declare module 'vue' {
4545
UNavigationMenu: typeof import('./node_modules/.pnpm/@nuxt+ui@4.6.1_@tiptap+extensions@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.3__@tiptap_fafa2c8fd8069605b89c294f69939ef7/node_modules/@nuxt/ui/dist/runtime/components/NavigationMenu.vue')['default']
4646
UPopover: typeof import('./node_modules/.pnpm/@nuxt+ui@4.6.1_@tiptap+extensions@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.3__@tiptap_fafa2c8fd8069605b89c294f69939ef7/node_modules/@nuxt/ui/dist/runtime/components/Popover.vue')['default']
4747
USelect: typeof import('./node_modules/.pnpm/@nuxt+ui@4.6.1_@tiptap+extensions@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.3__@tiptap_fafa2c8fd8069605b89c294f69939ef7/node_modules/@nuxt/ui/dist/runtime/components/Select.vue')['default']
48+
USelectMenu: typeof import('./node_modules/.pnpm/@nuxt+ui@4.6.1_@tiptap+extensions@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.3__@tiptap_fafa2c8fd8069605b89c294f69939ef7/node_modules/@nuxt/ui/dist/runtime/components/SelectMenu.vue')['default']
4849
USeparator: typeof import('./node_modules/.pnpm/@nuxt+ui@4.6.1_@tiptap+extensions@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.3__@tiptap_fafa2c8fd8069605b89c294f69939ef7/node_modules/@nuxt/ui/dist/runtime/components/Separator.vue')['default']
4950
USwitch: typeof import('./node_modules/.pnpm/@nuxt+ui@4.6.1_@tiptap+extensions@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.3__@tiptap_fafa2c8fd8069605b89c294f69939ef7/node_modules/@nuxt/ui/dist/runtime/components/Switch.vue')['default']
5051
UTable: typeof import('./node_modules/.pnpm/@nuxt+ui@4.6.1_@tiptap+extensions@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.3__@tiptap_fafa2c8fd8069605b89c294f69939ef7/node_modules/@nuxt/ui/dist/runtime/components/Table.vue')['default']

web/src/api/knowledge.ts

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import { agentOsRequest, readAgentOsErrorMessage } from '@/composables/request'
2+
import { APIRoutes } from './routes'
3+
import type { PaginatedResponse, ApiResult, ApiVoidResult } from './memory'
4+
5+
export type ContentStatus = 'pending' | 'processing' | 'completed' | 'failed'
6+
7+
export interface KnowledgeContent {
8+
id: string
9+
name?: string | null
10+
description?: string | null
11+
type?: string | null
12+
size?: string | null
13+
linked_to?: string | null
14+
metadata?: Record<string, unknown> | null
15+
access_count?: number | null
16+
status?: ContentStatus | null
17+
status_message?: string | null
18+
created_at?: string | null
19+
updated_at?: string | null
20+
}
21+
22+
export interface KnowledgeConfig {
23+
readers?: Record<string, { id: string; name?: string; description?: string }> | null
24+
readersForType?: Record<string, string[]> | null
25+
chunkers?: Record<string, { id: string; name?: string; description?: string }> | null
26+
filters?: string[] | null
27+
}
28+
29+
export async function listContentAPI(
30+
base: string,
31+
authToken: string | undefined,
32+
params: { limit?: number; page?: number; sort_by?: string; sort_order?: string } = {},
33+
): Promise<ApiResult<PaginatedResponse<KnowledgeContent>>> {
34+
const sp = new URLSearchParams()
35+
if (params.limit != null) sp.set('limit', String(params.limit))
36+
if (params.page != null) sp.set('page', String(params.page))
37+
if (params.sort_by) sp.set('sort_by', params.sort_by)
38+
if (params.sort_order) sp.set('sort_order', params.sort_order)
39+
const q = sp.toString()
40+
const path = APIRoutes.KnowledgeContent(base)
41+
const href = q ? `${path}?${q}` : path
42+
try {
43+
const res = await agentOsRequest(href, { method: 'GET', authToken })
44+
if (!res.ok) {
45+
const message = await readAgentOsErrorMessage(res)
46+
return { ok: false, status: res.status, message }
47+
}
48+
const data = await res.json()
49+
return { ok: true, data }
50+
} catch (e) {
51+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
52+
}
53+
}
54+
55+
export async function getConfigAPI(
56+
base: string,
57+
authToken: string | undefined,
58+
): Promise<ApiResult<KnowledgeConfig>> {
59+
try {
60+
const res = await agentOsRequest(APIRoutes.KnowledgeConfig(base), { method: 'GET', authToken })
61+
if (!res.ok) {
62+
const message = await readAgentOsErrorMessage(res)
63+
return { ok: false, status: res.status, message }
64+
}
65+
const data = await res.json()
66+
return { ok: true, data }
67+
} catch (e) {
68+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
69+
}
70+
}
71+
72+
export async function uploadContentAPI(
73+
base: string,
74+
authToken: string | undefined,
75+
formData: FormData,
76+
): Promise<ApiResult<KnowledgeContent>> {
77+
try {
78+
const res = await agentOsRequest(APIRoutes.KnowledgeContent(base), {
79+
method: 'POST',
80+
authToken,
81+
body: formData,
82+
})
83+
if (!res.ok) {
84+
const message = await readAgentOsErrorMessage(res)
85+
return { ok: false, status: res.status, message }
86+
}
87+
const data = await res.json()
88+
return { ok: true, data }
89+
} catch (e) {
90+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
91+
}
92+
}
93+
94+
export async function updateContentAPI(
95+
base: string,
96+
authToken: string | undefined,
97+
contentId: string,
98+
body: { name?: string; description?: string; metadata?: string },
99+
): Promise<ApiResult<KnowledgeContent>> {
100+
const formBody = new URLSearchParams()
101+
if (body.name != null) formBody.set('name', body.name)
102+
if (body.description != null) formBody.set('description', body.description)
103+
if (body.metadata != null) formBody.set('metadata', body.metadata)
104+
try {
105+
const res = await agentOsRequest(APIRoutes.KnowledgeContentById(base, contentId), {
106+
method: 'PATCH',
107+
authToken,
108+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
109+
body: formBody.toString(),
110+
})
111+
if (!res.ok) {
112+
const message = await readAgentOsErrorMessage(res)
113+
return { ok: false, status: res.status, message }
114+
}
115+
const data = await res.json()
116+
return { ok: true, data }
117+
} catch (e) {
118+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
119+
}
120+
}
121+
122+
export async function deleteContentAPI(
123+
base: string,
124+
authToken: string | undefined,
125+
contentId: string,
126+
): Promise<ApiVoidResult> {
127+
try {
128+
const res = await agentOsRequest(APIRoutes.KnowledgeContentById(base, contentId), {
129+
method: 'DELETE',
130+
authToken,
131+
})
132+
if (!res.ok) {
133+
const message = await readAgentOsErrorMessage(res)
134+
return { ok: false, status: res.status, message }
135+
}
136+
return { ok: true }
137+
} catch (e) {
138+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
139+
}
140+
}

web/src/api/memory.ts

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
import { agentOsRequest, readAgentOsErrorMessage } from '@/composables/request'
2+
import { APIRoutes } from './routes'
3+
4+
export interface UserMemory {
5+
memory_id: string
6+
memory: string
7+
topics?: string[] | null
8+
agent_id?: string | null
9+
team_id?: string | null
10+
user_id?: string | null
11+
updated_at?: string | null
12+
}
13+
14+
export interface UserMemoryCreate {
15+
memory: string
16+
user_id?: string | null
17+
topics?: string[] | null
18+
}
19+
20+
export interface UserStats {
21+
user_id: string
22+
total_memories: number
23+
last_memory_updated_at?: string | null
24+
}
25+
26+
export interface PaginationInfo {
27+
page: number
28+
limit: number
29+
total_pages: number
30+
total_count: number
31+
search_time_ms: number
32+
}
33+
34+
export interface PaginatedResponse<T> {
35+
data: T[]
36+
meta: PaginationInfo
37+
}
38+
39+
export type ApiResult<T> =
40+
| { ok: true; data: T }
41+
| { ok: false; status: number; message: string }
42+
43+
export type ApiVoidResult =
44+
| { ok: true }
45+
| { ok: false; status: number; message: string }
46+
47+
export async function getUserMemoryStatsAPI(
48+
base: string,
49+
authToken: string | undefined,
50+
params: { limit?: number; page?: number; user_id?: string } = {},
51+
): Promise<ApiResult<PaginatedResponse<UserStats>>> {
52+
const sp = new URLSearchParams()
53+
if (params.limit != null) sp.set('limit', String(params.limit))
54+
if (params.page != null) sp.set('page', String(params.page))
55+
if (params.user_id?.trim()) sp.set('user_id', params.user_id.trim())
56+
const q = sp.toString()
57+
const path = APIRoutes.GetUserMemoryStats(base)
58+
const href = q ? `${path}?${q}` : path
59+
try {
60+
const res = await agentOsRequest(href, { method: 'GET', authToken })
61+
if (!res.ok) {
62+
const message = await readAgentOsErrorMessage(res)
63+
return { ok: false, status: res.status, message }
64+
}
65+
const data = (await res.json()) as PaginatedResponse<UserStats>
66+
return { ok: true, data }
67+
} catch (e) {
68+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
69+
}
70+
}
71+
72+
export async function listMemoriesAPI(
73+
base: string,
74+
authToken: string | undefined,
75+
params: {
76+
user_id?: string
77+
limit?: number
78+
page?: number
79+
sort_by?: string
80+
sort_order?: 'asc' | 'desc'
81+
} = {},
82+
): Promise<ApiResult<PaginatedResponse<UserMemory>>> {
83+
const sp = new URLSearchParams()
84+
if (params.user_id?.trim()) sp.set('user_id', params.user_id.trim())
85+
if (params.limit != null) sp.set('limit', String(params.limit))
86+
if (params.page != null) sp.set('page', String(params.page))
87+
if (params.sort_by) sp.set('sort_by', params.sort_by)
88+
if (params.sort_order) sp.set('sort_order', params.sort_order)
89+
const q = sp.toString()
90+
const path = APIRoutes.ListMemories(base)
91+
const href = q ? `${path}?${q}` : path
92+
try {
93+
const res = await agentOsRequest(href, { method: 'GET', authToken })
94+
if (!res.ok) {
95+
const message = await readAgentOsErrorMessage(res)
96+
return { ok: false, status: res.status, message }
97+
}
98+
const data = (await res.json()) as PaginatedResponse<UserMemory>
99+
return { ok: true, data }
100+
} catch (e) {
101+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
102+
}
103+
}
104+
105+
export async function createMemoryAPI(
106+
base: string,
107+
authToken: string | undefined,
108+
body: UserMemoryCreate,
109+
): Promise<ApiResult<UserMemory>> {
110+
try {
111+
const res = await agentOsRequest(APIRoutes.CreateMemory(base), {
112+
method: 'POST',
113+
authToken,
114+
body: JSON.stringify(body),
115+
})
116+
if (!res.ok) {
117+
const message = await readAgentOsErrorMessage(res)
118+
return { ok: false, status: res.status, message }
119+
}
120+
const data = (await res.json()) as UserMemory
121+
return { ok: true, data }
122+
} catch (e) {
123+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
124+
}
125+
}
126+
127+
export async function updateMemoryAPI(
128+
base: string,
129+
authToken: string | undefined,
130+
memoryId: string,
131+
body: UserMemoryCreate,
132+
): Promise<ApiResult<UserMemory>> {
133+
try {
134+
const res = await agentOsRequest(APIRoutes.UpdateMemory(base, memoryId), {
135+
method: 'PATCH',
136+
authToken,
137+
body: JSON.stringify(body),
138+
})
139+
if (!res.ok) {
140+
const message = await readAgentOsErrorMessage(res)
141+
return { ok: false, status: res.status, message }
142+
}
143+
const data = (await res.json()) as UserMemory
144+
return { ok: true, data }
145+
} catch (e) {
146+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
147+
}
148+
}
149+
150+
export async function deleteMemoriesBatchAPI(
151+
base: string,
152+
authToken: string | undefined,
153+
memoryIds: string[],
154+
userId?: string,
155+
): Promise<ApiVoidResult> {
156+
try {
157+
const res = await agentOsRequest(APIRoutes.DeleteMemories(base), {
158+
method: 'DELETE',
159+
authToken,
160+
body: JSON.stringify({
161+
memory_ids: memoryIds,
162+
...(userId?.trim() ? { user_id: userId.trim() } : {}),
163+
}),
164+
})
165+
if (!res.ok) {
166+
const message = await readAgentOsErrorMessage(res)
167+
return { ok: false, status: res.status, message }
168+
}
169+
return { ok: true }
170+
} catch (e) {
171+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
172+
}
173+
}
174+
175+
export async function deleteMemoryAPI(
176+
base: string,
177+
authToken: string | undefined,
178+
memoryId: string,
179+
userId?: string,
180+
): Promise<ApiVoidResult> {
181+
const sp = new URLSearchParams()
182+
if (userId?.trim()) sp.set('user_id', userId.trim())
183+
const q = sp.toString()
184+
const path = APIRoutes.DeleteMemory(base, memoryId)
185+
const href = q ? `${path}?${q}` : path
186+
try {
187+
const res = await agentOsRequest(href, { method: 'DELETE', authToken })
188+
if (!res.ok) {
189+
const message = await readAgentOsErrorMessage(res)
190+
return { ok: false, status: res.status, message }
191+
}
192+
return { ok: true }
193+
} catch (e) {
194+
return { ok: false, status: 0, message: e instanceof Error ? e.message : 'Network error' }
195+
}
196+
}

0 commit comments

Comments
 (0)