refactor(ai-moderation): enhance llmClient flexibility and idempotency
Update the LLM client to support streaming responses and improve database migration idempotency. - Add `stream` support to `llmChat` with dynamic chunk parsing for compatibility across different LLM providers. - Remove hardcoded default temperature and top_p to allow for more flexible parameter passing. - Update database migrations to use `IF NOT EXISTS` for tables and indexes to prevent errors during re-runs.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
CREATE TABLE "channel_cultures" (
|
||||
CREATE TABLE IF NOT EXISTS "channel_cultures" (
|
||||
"channel_id" text PRIMARY KEY NOT NULL,
|
||||
"guild_id" text NOT NULL,
|
||||
"culture_summary" text NOT NULL,
|
||||
"last_analyzed_at" bigint NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "user_reputations" (
|
||||
CREATE TABLE IF NOT EXISTS "user_reputations" (
|
||||
"user_id" text PRIMARY KEY NOT NULL,
|
||||
"guild_id" text NOT NULL,
|
||||
"trust_score" integer DEFAULT 50 NOT NULL,
|
||||
@@ -16,6 +16,6 @@ CREATE TABLE "user_reputations" (
|
||||
"updated_at" bigint NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "idx_channel_cultures_guild_id" ON "channel_cultures" USING btree ("guild_id");--> statement-breakpoint
|
||||
CREATE INDEX "idx_user_reputations_guild_id" ON "user_reputations" USING btree ("guild_id");--> statement-breakpoint
|
||||
CREATE INDEX "idx_user_reputations_trust_score" ON "user_reputations" USING btree ("trust_score");
|
||||
CREATE INDEX IF NOT EXISTS "idx_channel_cultures_guild_id" ON "channel_cultures" USING btree ("guild_id");--> statement-breakpoint
|
||||
CREATE INDEX IF NOT EXISTS "idx_user_reputations_guild_id" ON "user_reputations" USING btree ("guild_id");--> statement-breakpoint
|
||||
CREATE INDEX IF NOT EXISTS "idx_user_reputations_trust_score" ON "user_reputations" USING btree ("trust_score");
|
||||
Reference in New Issue
Block a user