Skip to content

Commit

Permalink
Merge pull request #76 from animalnots/dev
Browse files Browse the repository at this point in the history
v1.13.0
  • Loading branch information
animalnots authored Nov 4, 2024
2 parents 76223f9 + 0ddaf5c commit 8c768cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "better-chatgpt",
"private": true,
"version": "1.12.0",
"version": "1.13.0",
"type": "module",
"homepage": "./",
"main": "electron/index.cjs",
Expand Down
6 changes: 5 additions & 1 deletion src/utils/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ const contentToMarkdown = (contents: ContentInterface[]): string => {
let text = '';
contents.forEach((content) => {
if (content) {
text += isTextContent(content) ? content.text : isImageContent(content) ? `![image](${content.image_url.url})` : '';
if (isTextContent(content)) {
text += content.text;
} else if (isImageContent(content)) {
text += `![image](${content.image_url.url})`;
}
text += "\n\n";
}
});
Expand Down
4 changes: 3 additions & 1 deletion src/utils/messageUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ export const getChatGPTEncoding = (
const serialized = [
messages
.map(({ role, content }) => {
const textContent = content[0];
const text = textContent && isTextContent(textContent) ? textContent.text : '';
return `<|im_start|>${role}${roleSep}${
(content[0] as TextContentInterface).text
text
}<|im_end|>`;
})
.join(msgSep),
Expand Down

0 comments on commit 8c768cd

Please sign in to comment.