feat: add USE_FIREHOSE env var for faster responses
This commit is contained in:
parent
df5933cbc9
commit
f237f33946
3 changed files with 16 additions and 3 deletions
|
|
@ -14,4 +14,7 @@ HANDLE=""
|
|||
BSKY_PASSWORD=""
|
||||
|
||||
# https://aistudio.google.com/apikey
|
||||
GEMINI_API_KEY=""
|
||||
GEMINI_API_KEY=""
|
||||
|
||||
DAILY_QUERY_LIMIT=15
|
||||
USE_FIREHOSE=false
|
||||
|
|
@ -1,10 +1,15 @@
|
|||
import { GoogleGenAI } from "@google/genai";
|
||||
import { Bot } from "@skyware/bot";
|
||||
import { Bot, EventStrategy } from "@skyware/bot";
|
||||
import { env } from "./env";
|
||||
|
||||
export const bot = new Bot({
|
||||
service: env.SERVICE,
|
||||
emitChatEvents: true,
|
||||
eventEmitterOptions: {
|
||||
strategy: env.USE_FIREHOSE
|
||||
? EventStrategy.Firehose
|
||||
: EventStrategy.Polling,
|
||||
},
|
||||
});
|
||||
|
||||
export const ai = new GoogleGenAI({
|
||||
|
|
|
|||
|
|
@ -17,9 +17,14 @@ const envSchema = z.object({
|
|||
|
||||
GEMINI_API_KEY: z.string(),
|
||||
DAILY_QUERY_LIMIT: z.preprocess(
|
||||
(val) => (typeof val === "string" && val.trim() !== "") ? Number(val) : undefined,
|
||||
(val) =>
|
||||
(typeof val === "string" && val.trim() !== "") ? Number(val) : undefined,
|
||||
z.number().int().positive().default(15),
|
||||
),
|
||||
USE_FIREHOSE: z.preprocess(
|
||||
(val) => val === "true",
|
||||
z.boolean().default(false),
|
||||
),
|
||||
});
|
||||
|
||||
export type Env = z.infer<typeof envSchema>;
|
||||
|
|
|
|||
Loading…
Reference in a new issue