Skip to content

Commit

Permalink
fix: chatgpt import
Browse files Browse the repository at this point in the history
  • Loading branch information
ztjhz committed Apr 26, 2023
1 parent 5fdaa1d commit 86f7313
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/types/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

Expand Down

0 comments on commit 86f7313

Please sign in to comment.