Move createPayload and sse to data-provider, create TSubmission type

This commit is contained in:
Daniel D Orlando 2023-04-06 14:09:13 -07:00
parent 0fb9820110
commit 7b7ba96786
4 changed files with 38 additions and 19 deletions

View file

@ -1,7 +1,7 @@
import { useEffect } from 'react';
import { useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil';
import { SSE } from '~/utils/sse.mjs';
import createPayload from '~/utils/createPayload';
import { SSE } from '~/data-provider/sse.mjs';
import createPayload from '~/data-provider/createPayload';
import store from '~/store';

View file

@ -1,4 +1,6 @@
export default function createPayload(submission) {
import type { TSubmission } from './types';
export default function createPayload(submission: TSubmission) {
const { conversation, message, endpointOption } = submission;
const { conversationId } = conversation;
const { endpoint } = endpointOption;

View file

@ -1,9 +1,7 @@
export type TMessage = {
messageId: string,
conversationId: string,
// conversationSignature: string | null,
clientId: string,
// invocationId: string,
parentMessageId: string,
sender: string,
text: string,
@ -11,27 +9,40 @@ export type TMessage = {
error: boolean,
createdAt: string,
updatedAt: string,
// searchResult: string[],
// submitting: boolean,
// children?: any[] | undefined,
// bgColor?: string,
// model?: string,
// cancelled?: boolean
};
export type TMessageTreeNode = {}
export type TSearchMessage = {}
export type TSearchMessageTreeNode = {}
export type TMessageToAsk = {}
export type TSubmission = {
clientId?: string;
context?: string;
conversationId?: string;
conversationSignature?: string;
current: boolean;
endpoint: EModelEndpoint;
invocationId: number;
isCreatedByUser: boolean;
jailbreak: boolean;
jailbreakConversationId?: string;
messageId: string;
overrideParentMessageId?: string | boolean;
parentMessageId?: string;
sender: string;
systemMessage?: string;
text: string;
toneStyle?: string;
model?: string;
promptPrefix?: string;
temperature?: number;
top_p?: number;
presence_penalty?: number;
frequence_penalty?: number;
}
export enum EModelEndpoint {
azureOpenAI = 'azureOpenAI',
openAI = 'openAI',
bingAI = 'bingAI',
chatGPT = 'chatGPT',
chatGPTBrowser = 'chatGPTBrowser'
}
@ -143,4 +154,10 @@ export type TEndpoints = {
export type TUpdateTokenCountResponse = {
count: number,
};
};
export type TMessageTreeNode = {}
export type TSearchMessage = {}
export type TSearchMessageTreeNode = {}