Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

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

Daniel D Orlando7b7ba96786d6
diff --git a/client/src/components/MessageHandler/index.jsx b/client/src/components/MessageHandler/index.jsx
index a443e7aa84..24ec7c3dc4 100644
--- a/client/src/components/MessageHandler/index.jsx
+++ b/client/src/components/MessageHandler/index.jsx
@@ -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';
diff --git a/client/src/utils/createPayload.js b/client/src/data-provider/createPayload.ts
similarity index 81%
rename from client/src/utils/createPayload.js
rename to client/src/data-provider/createPayload.ts
index 3035663fef..5c60e8f197 100644
--- a/client/src/utils/createPayload.js
+++ b/client/src/data-provider/createPayload.ts
@@ -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;
diff --git a/client/src/utils/sse.mjs b/client/src/data-provider/sse.mjs
similarity index 100%
rename from client/src/utils/sse.mjs
rename to client/src/data-provider/sse.mjs
diff --git a/client/src/data-provider/types.ts b/client/src/data-provider/types.ts
index 060abe1483..b3206fce64 100644
--- a/client/src/data-provider/types.ts
+++ b/client/src/data-provider/types.ts
@@ -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,
-};
\ No newline at end of file
+};
+
+export type TMessageTreeNode = {}
+
+export type TSearchMessage = {}
+
+export type TSearchMessageTreeNode = {}
\ No newline at end of file