fix: chatgpt import

This commit is contained in:
Jing Hua 2023-04-26 15:25:36 +08:00
parent 5fdaa1dbda
commit 86f7313923
2 changed files with 3 additions and 3 deletions

View file

@ -14,12 +14,12 @@ export type OpenAIChat = {
mapping: {
[key: string]: {
id: string;
message: {
message?: {
author: {
role: Role;
};
content: {
parts: string[];
parts?: string[];
};
} | null;
parent: string | null;

View file

@ -102,7 +102,7 @@ export const convertOpenAIToBetterChatGPTFormat = (
// Extract message if it exists
if (node.message) {
const { role } = node.message.author;
const content = node.message.content.parts.join('');
const content = node.message.content.parts?.join('') || '';
if (content.length > 0) messages.push({ role, content });
}