feat(chat): support ai photo viewing
This commit is contained in:
@@ -12,6 +12,7 @@ export class ChatMessage {
|
||||
declare readonly content: string;
|
||||
declare readonly id: string;
|
||||
declare readonly createdAt: string;
|
||||
declare readonly imageUrl: string | null;
|
||||
declare readonly isPrivate: boolean | null;
|
||||
declare readonly privateLocked: boolean | null;
|
||||
declare readonly privateHint: string | null;
|
||||
|
||||
@@ -124,6 +124,7 @@ export class ChatRepository implements IChatRepository {
|
||||
role: message.role,
|
||||
content: message.content,
|
||||
createdAt: message.createdAt,
|
||||
imageUrl: message.imageUrl,
|
||||
sessionId: "",
|
||||
});
|
||||
}
|
||||
@@ -135,6 +136,7 @@ export class ChatRepository implements IChatRepository {
|
||||
role: local.role,
|
||||
content: local.content,
|
||||
createdAt: local.createdAt,
|
||||
imageUrl: local.imageUrl,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,13 +11,16 @@ export const ChatMessageSchema = z
|
||||
id: z.string().default(""),
|
||||
createdAt: z.string().default(""),
|
||||
created_at: z.string().optional(),
|
||||
imageUrl: z.string().nullable().default(null),
|
||||
image_url: z.string().nullable().optional(),
|
||||
isPrivate: z.boolean().nullable().default(null),
|
||||
privateLocked: z.boolean().nullable().default(null),
|
||||
privateHint: z.string().nullable().default(null),
|
||||
})
|
||||
.transform(({ created_at, ...data }) => ({
|
||||
.transform(({ created_at, image_url, ...data }) => ({
|
||||
...data,
|
||||
createdAt: data.createdAt || created_at || "",
|
||||
imageUrl: data.imageUrl || image_url || null,
|
||||
}));
|
||||
|
||||
export type ChatMessageInput = z.input<typeof ChatMessageSchema>;
|
||||
|
||||
@@ -21,6 +21,7 @@ export interface LocalMessageRow {
|
||||
role: string;
|
||||
content: string;
|
||||
createdAt: string;
|
||||
imageUrl?: string | null;
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ export const LocalMessageSchema = z.object({
|
||||
role: z.string(),
|
||||
content: z.string(),
|
||||
createdAt: z.string().default(""),
|
||||
imageUrl: z.string().nullable().default(null),
|
||||
sessionId: z.string().default(""),
|
||||
});
|
||||
|
||||
@@ -33,6 +34,7 @@ export class LocalMessage {
|
||||
declare readonly role: string;
|
||||
declare readonly content: string;
|
||||
declare readonly createdAt: string;
|
||||
declare readonly imageUrl: string | null;
|
||||
declare readonly sessionId: string;
|
||||
|
||||
private constructor(input: LocalMessageInput) {
|
||||
@@ -60,6 +62,7 @@ export class LocalMessage {
|
||||
role: this.role,
|
||||
content: this.content,
|
||||
createdAt: this.createdAt,
|
||||
imageUrl: this.imageUrl,
|
||||
sessionId: this.sessionId,
|
||||
};
|
||||
}
|
||||
@@ -71,6 +74,7 @@ export class LocalMessage {
|
||||
role: row.role,
|
||||
content: row.content,
|
||||
createdAt: row.createdAt,
|
||||
imageUrl: row.imageUrl ?? null,
|
||||
sessionId: row.sessionId,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user