Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fixxx

Julius Marminge35817601ff3f
diff --git a/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts b/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
index 5d5d77c48..a4f260118 100644
--- a/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
+++ b/apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
@@ -43,12 +43,13 @@ const ProjectionProjectDbRowSchema = ProjectionProject.mapFields(
scripts: Schema.fromJsonString(Schema.Array(ProjectScript)),
}),
);
+const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(
+ Struct.assign({
+ isStreaming: Schema.Number,
+ attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
+ }),
+);
const ProjectionThreadDbRowSchema = ProjectionThread;
-const ProjectionThreadMessageDbRowSchema = Schema.Struct({
- ...ProjectionThreadMessage.fields,
- isStreaming: Schema.Number,
- attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
-});
const ProjectionThreadActivityDbRowSchema = ProjectionThreadActivity.mapFields(
Struct.assign({
payload: Schema.fromJsonString(Schema.Unknown),
diff --git a/apps/server/src/persistence/Layers/ProjectionThreadMessages.ts b/apps/server/src/persistence/Layers/ProjectionThreadMessages.ts
index dd30f35f9..6f0b25ddf 100644
--- a/apps/server/src/persistence/Layers/ProjectionThreadMessages.ts
+++ b/apps/server/src/persistence/Layers/ProjectionThreadMessages.ts
@@ -1,6 +1,6 @@
import * as SqlClient from "effect/unstable/sql/SqlClient";
import * as SqlSchema from "effect/unstable/sql/SqlSchema";
-import { Effect, Layer, Schema } from "effect";
+import { Effect, Layer, Schema, Struct } from "effect";
import { ChatAttachment } from "@t3tools/contracts";
import { toPersistenceSqlError } from "../Errors.ts";
@@ -12,11 +12,12 @@ import {
ProjectionThreadMessage,
} from "../Services/ProjectionThreadMessages.ts";
-const ProjectionThreadMessageDbRowSchema = Schema.Struct({
- ...ProjectionThreadMessage.fields,
- isStreaming: Schema.Number,
- attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
-});
+const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(
+ Struct.assign({
+ isStreaming: Schema.Number,
+ attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
+ }),
+);
const makeProjectionThreadMessageRepository = Effect.gen(function* () {
const sql = yield* SqlClient.SqlClient;
@@ -24,7 +25,8 @@ const makeProjectionThreadMessageRepository = Effect.gen(function* () {
const upsertProjectionThreadMessageRow = SqlSchema.void({
Request: ProjectionThreadMessage,
execute: (row) => {
- const nextAttachmentsJson = row.attachments !== undefined ? JSON.stringify(row.attachments) : null;
+ const nextAttachmentsJson =
+ row.attachments !== undefined ? JSON.stringify(row.attachments) : null;
return sql`
INSERT INTO projection_thread_messages (
message_id,