generalize
This commit is contained in:
parent
5649675701
commit
25f8df5a80
1 changed files with 3 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ import { DurableObject } from "cloudflare:workers";
|
||||||
import type { Env } from "../src/types";
|
import type { Env } from "../src/types";
|
||||||
import { createOpusPacketizer } from "../src/opus";
|
import { createOpusPacketizer } from "../src/opus";
|
||||||
import { createSttSession } from "./stt";
|
import { createSttSession } from "./stt";
|
||||||
import { generateOpenAIReply, type ChatMessage } from "./llm";
|
import { generateOpenAIReply as generateLLMReply, type ChatMessage } from "./llm";
|
||||||
import { synthesizeSpeech } from "./tts";
|
import { synthesizeSpeech } from "./tts";
|
||||||
import type { TranscriberSession } from "@cloudflare/voice";
|
import type { TranscriberSession } from "@cloudflare/voice";
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ export class ElatoVoiceSession extends DurableObject<Env> {
|
||||||
console.log(`[cloudflare][stt] transcript: ${transcript}`);
|
console.log(`[cloudflare][stt] transcript: ${transcript}`);
|
||||||
/* Add user transcript DB call here */
|
/* Add user transcript DB call here */
|
||||||
|
|
||||||
const reply = await generateOpenAIReply(this.env, transcript, this.history);
|
const reply = await generateLLMReply(this.env, transcript, this.history);
|
||||||
console.log(`[cloudflare][llm] generated reply (${reply.length} chars)`);
|
console.log(`[cloudflare][llm] generated reply (${reply.length} chars)`);
|
||||||
this.history.push(
|
this.history.push(
|
||||||
{ role: "user", content: transcript },
|
{ role: "user", content: transcript },
|
||||||
|
|
@ -161,7 +161,7 @@ export class ElatoVoiceSession extends DurableObject<Env> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log("[cloudflare][startup] starting initial turn");
|
console.log("[cloudflare][startup] starting initial turn");
|
||||||
const reply = await generateOpenAIReply(this.env, null, this.history);
|
const reply = await generateLLMReply(this.env, null, this.history);
|
||||||
console.log(`[cloudflare][llm] initial reply (${reply.length} chars)`);
|
console.log(`[cloudflare][llm] initial reply (${reply.length} chars)`);
|
||||||
this.history.push({ role: "assistant", content: reply });
|
this.history.push({ role: "assistant", content: reply });
|
||||||
/* Add AI transcript DB call here */
|
/* Add AI transcript DB call here */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue