feat: implement local audio streaming with controls in voice components
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { parentPort } from "node:worker_threads";
|
||||
import { initializeDatabase } from "../database/drizzle";
|
||||
import { buildConversationPromptMessages } from "./conversationContext";
|
||||
import { runModerationAnalysis } from "./llmModerationClient";
|
||||
import {
|
||||
@@ -9,6 +10,8 @@ import type { MessageRecord } from "./types";
|
||||
|
||||
const MAX_CONTEXT_TOKENS = 8000;
|
||||
|
||||
let dbInitialized = false;
|
||||
|
||||
interface AnalysisWorkerRequest {
|
||||
conversationKey: string;
|
||||
messages: MessageRecord[];
|
||||
@@ -32,6 +35,10 @@ async function processAnalysisRequest({
|
||||
messages,
|
||||
}: AnalysisWorkerRequest): Promise<AnalysisWorkerResponse> {
|
||||
try {
|
||||
if (!dbInitialized) {
|
||||
await initializeDatabase();
|
||||
dbInitialized = true;
|
||||
}
|
||||
const firstMessage = messages[0];
|
||||
if (!firstMessage) return { ok: true, conversationKey, rows: [] };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user