feat: add Materi section + AI agent RAG to GMW business flow
Backend: - New materi module: schema (materi_documents table), repository, service - ragClient: semantic + keyword search over materi docs, plus Discord archive via Qdrant, then LLM answer generation (RAG) - Wire materiRouter into appRouter (list/detail/create/update/delete/chat) Frontend: - New types (MateriDocument, CreateMateriInput, RAG chat shapes) - API client (SSR HTTP RPCLink + browser WS RPCLink) - Routes: /materi list, /materi/[id] detail, /materi/new form, /materi/chat RAG chat UI - Sidebar nav item 'Materi' Migration: scripts/add-materi-documents.sql (CREATE TABLE IF NOT EXISTS)
This commit is contained in:
@@ -6,6 +6,13 @@ import { chatbotService } from "../modules/chatbot/chatbot.service";
|
||||
// ── Service imports ──────────────────────────────────────────────
|
||||
import { dashboardService } from "../modules/dashboard/dashboard.service";
|
||||
import { knowledgeService } from "../modules/knowledge/knowledge.service";
|
||||
import {
|
||||
materiQuerySchema,
|
||||
materiRagChatSchema,
|
||||
createMateriSchema,
|
||||
updateMateriSchema,
|
||||
materiService,
|
||||
} from "../modules/materi/index.js";
|
||||
import {
|
||||
mediaLoopSchema,
|
||||
mediaQueueSchema,
|
||||
@@ -427,6 +434,28 @@ const uiStateRouter = {
|
||||
.handler(({ input }) => uiStateService.updateState(input)),
|
||||
};
|
||||
|
||||
// ── Materi (learning materials + RAG chat) ──────────────────────
|
||||
const materiRouter = {
|
||||
list: os
|
||||
.input(materiQuerySchema)
|
||||
.handler(({ input }) => materiService.list(input)),
|
||||
detail: os
|
||||
.input(z.object({ id: z.string() }))
|
||||
.handler(({ input }) => materiService.byId(input.id)),
|
||||
create: os
|
||||
.input(createMateriSchema)
|
||||
.handler(({ input }) => materiService.create(input, "anonymous")),
|
||||
update: os
|
||||
.input(z.object({ id: z.string() }).merge(updateMateriSchema))
|
||||
.handler(({ input }) => materiService.update(input.id, input)),
|
||||
delete: os
|
||||
.input(z.object({ id: z.string() }))
|
||||
.handler(({ input }) => materiService.delete(input.id)),
|
||||
chat: os
|
||||
.input(materiRagChatSchema)
|
||||
.handler(({ input }) => materiService.ragChat(input, "anonymous")),
|
||||
};
|
||||
|
||||
// ── Root router ───────────────────────────────────────────────────
|
||||
export const appRouter = {
|
||||
dashboard: dashboardRouter,
|
||||
@@ -440,6 +469,7 @@ export const appRouter = {
|
||||
config: configRouter,
|
||||
uiState: uiStateRouter,
|
||||
knowledge: knowledgeRouter,
|
||||
materi: materiRouter,
|
||||
};
|
||||
|
||||
export type AppRouter = typeof appRouter;
|
||||
|
||||
Reference in New Issue
Block a user