mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
Markdown export: move the emoji to the end of the line (#12278)
Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
@@ -478,25 +478,25 @@ describe('chatCommand', () => {
|
|||||||
const expectedPath = path.join(process.cwd(), 'my-chat.md');
|
const expectedPath = path.join(process.cwd(), 'my-chat.md');
|
||||||
const [actualPath, actualContent] = mockFs.writeFile.mock.calls[0];
|
const [actualPath, actualContent] = mockFs.writeFile.mock.calls[0];
|
||||||
expect(actualPath).toEqual(expectedPath);
|
expect(actualPath).toEqual(expectedPath);
|
||||||
const expectedContent = `🧑💻 ## USER
|
const expectedContent = `## USER 🧑💻
|
||||||
|
|
||||||
context
|
context
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
✨ ## MODEL
|
## MODEL ✨
|
||||||
|
|
||||||
context response
|
context response
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
🧑💻 ## USER
|
## USER 🧑💻
|
||||||
|
|
||||||
Hello
|
Hello
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
✨ ## MODEL
|
## MODEL ✨
|
||||||
|
|
||||||
Hi there!`;
|
Hi there!`;
|
||||||
expect(actualContent).toEqual(expectedContent);
|
expect(actualContent).toEqual(expectedContent);
|
||||||
@@ -570,7 +570,7 @@ Hi there!`;
|
|||||||
const { role, parts } = mockHistory[index];
|
const { role, parts } = mockHistory[index];
|
||||||
const text = parts.map((p) => p.text).join('');
|
const text = parts.map((p) => p.text).join('');
|
||||||
const roleIcon = role === 'user' ? '🧑💻' : '✨';
|
const roleIcon = role === 'user' ? '🧑💻' : '✨';
|
||||||
expect(entry).toBe(`${roleIcon} ## ${role.toUpperCase()}\n\n${text}`);
|
expect(entry).toBe(`## ${role.toUpperCase()} ${roleIcon}\n\n${text}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -584,9 +584,9 @@ Hi there!`;
|
|||||||
];
|
];
|
||||||
|
|
||||||
const expectedMarkdown =
|
const expectedMarkdown =
|
||||||
'🧑💻 ## USER\n\nHello\n\n---\n\n' +
|
'## USER 🧑💻\n\nHello\n\n---\n\n' +
|
||||||
'✨ ## MODEL\n\nHi there!\n\n---\n\n' +
|
'## MODEL ✨\n\nHi there!\n\n---\n\n' +
|
||||||
'🧑💻 ## USER\n\nHow are you?';
|
'## USER 🧑💻\n\nHow are you?';
|
||||||
|
|
||||||
const result = serializeHistoryToMarkdown(history);
|
const result = serializeHistoryToMarkdown(history);
|
||||||
expect(result).toBe(expectedMarkdown);
|
expect(result).toBe(expectedMarkdown);
|
||||||
@@ -605,19 +605,19 @@ Hi there!`;
|
|||||||
{ role: 'user', parts: [{ text: 'How are you?' }] },
|
{ role: 'user', parts: [{ text: 'How are you?' }] },
|
||||||
];
|
];
|
||||||
|
|
||||||
const expectedMarkdown = `🧑💻 ## USER
|
const expectedMarkdown = `## USER 🧑💻
|
||||||
|
|
||||||
Hello
|
Hello
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
✨ ## MODEL
|
## MODEL ✨
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
🧑💻 ## USER
|
## USER 🧑💻
|
||||||
|
|
||||||
How are you?`;
|
How are you?`;
|
||||||
|
|
||||||
@@ -655,13 +655,13 @@ How are you?`;
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const expectedMarkdown = `🧑💻 ## USER
|
const expectedMarkdown = `## USER 🧑💻
|
||||||
|
|
||||||
Please call a function.
|
Please call a function.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
✨ ## MODEL
|
## MODEL ✨
|
||||||
|
|
||||||
**Tool Command**:
|
**Tool Command**:
|
||||||
\`\`\`json
|
\`\`\`json
|
||||||
@@ -675,7 +675,7 @@ Please call a function.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
🧑💻 ## USER
|
## USER 🧑💻
|
||||||
|
|
||||||
**Tool Response**:
|
**Tool Response**:
|
||||||
\`\`\`json
|
\`\`\`json
|
||||||
@@ -697,13 +697,13 @@ Please call a function.
|
|||||||
{ parts: [{ text: 'Hi there!' }] },
|
{ parts: [{ text: 'Hi there!' }] },
|
||||||
];
|
];
|
||||||
|
|
||||||
const expectedMarkdown = `🧑💻 ## USER
|
const expectedMarkdown = `## USER 🧑💻
|
||||||
|
|
||||||
Hello
|
Hello
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
✨ ## MODEL
|
## MODEL ✨
|
||||||
|
|
||||||
Hi there!`;
|
Hi there!`;
|
||||||
|
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ export function serializeHistoryToMarkdown(history: Content[]): string {
|
|||||||
})
|
})
|
||||||
.join('') || '';
|
.join('') || '';
|
||||||
const roleIcon = item.role === 'user' ? '🧑💻' : '✨';
|
const roleIcon = item.role === 'user' ? '🧑💻' : '✨';
|
||||||
return `${roleIcon} ## ${(item.role || 'model').toUpperCase()}\n\n${text}`;
|
return `## ${(item.role || 'model').toUpperCase()} ${roleIcon}\n\n${text}`;
|
||||||
})
|
})
|
||||||
.join('\n\n---\n\n');
|
.join('\n\n---\n\n');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user