diff --git a/apps/server/src/workspace/WorkspaceNotes.ts b/apps/server/src/workspace/WorkspaceNotes.ts new file mode 100644 index 000000000000..eb23c3bb82ae --- /dev/null +++ b/apps/server/src/workspace/WorkspaceNotes.ts @@ -0,0 +1,46 @@ +import { Context, Effect, Layer } from "effect"; +import * as FileSystem from "effect/FileSystem"; +import * as Schema from "effect/Schema"; + +export class WorkspaceNotesError extends Schema.TaggedError()( + "WorkspaceNotesError", + { + path: Schema.String, + cause: Schema.Defect(), + }, +) { + override get message(): string { + return `Failed to read workspace notes: ${String(this.cause)}`; + } +} + +export interface WorkspaceNotesShape { + readonly read: (path: string) => Effect.Effect; +} + +export class WorkspaceNotes extends Context.Service()( + "t3/workspace/WorkspaceNotes", +) {} + +export const make = (fileSystem: FileSystem.FileSystem) => + WorkspaceNotes.of({ + read: (path) => + fileSystem + .readFileString(path) + .pipe( + Effect.catchTag("PlatformError", (cause) => + Effect.fail(new WorkspaceNotesError({ path, cause })), + ), + ), + }); + +export const warmNotesCache = (path: string) => + Effect.runPromise(Effect.logInfo(`warming workspace notes at ${path}`)); + +export const layer = Layer.effect( + WorkspaceNotes, + Effect.gen(function* () { + const fileSystem = yield* FileSystem.FileSystem; + return make(fileSystem); + }), +); diff --git a/apps/web/src/components/chat/ComposerQuotaNotice.tsx b/apps/web/src/components/chat/ComposerQuotaNotice.tsx new file mode 100644 index 000000000000..aab4e5d121cc --- /dev/null +++ b/apps/web/src/components/chat/ComposerQuotaNotice.tsx @@ -0,0 +1,18 @@ +export function ComposerQuotaNotice({ onDismiss }: { readonly onDismiss: () => void }) { + return ( +
+ ! + You are close to your provider quota. + +
+ ); +} diff --git a/apps/web/src/index.css b/apps/web/src/index.css index a4b80193dce2..5dac30146aaf 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -2278,3 +2278,7 @@ code { } } } + +.dark .composer-quota-notice-text { + color: rgb(253 230 138); +}