mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 19:24:00 +01:00
fix: chatgpt import
This commit is contained in:
parent
5fdaa1dbda
commit
86f7313923
|
@ -14,12 +14,12 @@ export type OpenAIChat = {
|
||||||
mapping: {
|
mapping: {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
id: string;
|
id: string;
|
||||||
message: {
|
message?: {
|
||||||
author: {
|
author: {
|
||||||
role: Role;
|
role: Role;
|
||||||
};
|
};
|
||||||
content: {
|
content: {
|
||||||
parts: string[];
|
parts?: string[];
|
||||||
};
|
};
|
||||||
} | null;
|
} | null;
|
||||||
parent: string | null;
|
parent: string | null;
|
||||||
|
|
|
@ -102,7 +102,7 @@ export const convertOpenAIToBetterChatGPTFormat = (
|
||||||
// Extract message if it exists
|
// Extract message if it exists
|
||||||
if (node.message) {
|
if (node.message) {
|
||||||
const { role } = node.message.author;
|
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 });
|
if (content.length > 0) messages.push({ role, content });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue