mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
refactor(MessageHandler -> useServerStream): convert all relating files to TS and correct typings based on this change: properly refactor MessageHandler to a custom hook, where it's passed a submission object to instantiate the stream. This is the bare minimum groundwork for potentially having multiple streams running, which would be a big project to modularize a lot of the global state into maps/multiple streams, particular useful for having multiple views in place
This commit is contained in:
parent
8b4d3c2c21
commit
c74c68a135
5 changed files with 83 additions and 87 deletions
|
|
@ -12,32 +12,6 @@ export enum EModelEndpoint {
|
|||
|
||||
export const eModelEndpointSchema = z.nativeEnum(EModelEndpoint);
|
||||
|
||||
export const tMessageSchema = z.object({
|
||||
messageId: z.string(),
|
||||
clientId: z.string().nullable().optional(),
|
||||
conversationId: z.string().nullable(),
|
||||
parentMessageId: z.string().nullable(),
|
||||
sender: z.string(),
|
||||
text: z.string(),
|
||||
isCreatedByUser: z.boolean(),
|
||||
error: z.boolean(),
|
||||
createdAt: z
|
||||
.string()
|
||||
.optional()
|
||||
.default(() => new Date().toISOString()),
|
||||
updatedAt: z
|
||||
.string()
|
||||
.optional()
|
||||
.default(() => new Date().toISOString()),
|
||||
current: z.boolean().optional(),
|
||||
unfinished: z.boolean().optional(),
|
||||
submitting: z.boolean().optional(),
|
||||
searchResult: z.boolean().optional(),
|
||||
finish_reason: z.string().optional(),
|
||||
});
|
||||
|
||||
export type TMessage = z.input<typeof tMessageSchema>;
|
||||
|
||||
export const tPluginAuthConfigSchema = z.object({
|
||||
authField: z.string(),
|
||||
label: z.string(),
|
||||
|
|
@ -76,6 +50,36 @@ export const tAgentOptionsSchema = z.object({
|
|||
temperature: z.number(),
|
||||
});
|
||||
|
||||
export const tMessageSchema = z.object({
|
||||
messageId: z.string(),
|
||||
clientId: z.string().nullable().optional(),
|
||||
conversationId: z.string().nullable(),
|
||||
parentMessageId: z.string().nullable(),
|
||||
responseMessageId: z.string().nullable().optional(),
|
||||
overrideParentMessageId: z.string().nullable().optional(),
|
||||
plugin: tPluginSchema.nullable().optional(),
|
||||
sender: z.string(),
|
||||
text: z.string(),
|
||||
generation: z.string().nullable().optional(),
|
||||
isCreatedByUser: z.boolean(),
|
||||
error: z.boolean(),
|
||||
createdAt: z
|
||||
.string()
|
||||
.optional()
|
||||
.default(() => new Date().toISOString()),
|
||||
updatedAt: z
|
||||
.string()
|
||||
.optional()
|
||||
.default(() => new Date().toISOString()),
|
||||
current: z.boolean().optional(),
|
||||
unfinished: z.boolean().optional(),
|
||||
submitting: z.boolean().optional(),
|
||||
searchResult: z.boolean().optional(),
|
||||
finish_reason: z.string().optional(),
|
||||
});
|
||||
|
||||
export type TMessage = z.input<typeof tMessageSchema>;
|
||||
|
||||
export const tConversationSchema = z.object({
|
||||
conversationId: z.string().nullable(),
|
||||
title: z.string(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue