Spaces:
Paused
Paused
Download src/lib/utils/formatHistory.ts from pjpjq/perplexica-auth: direct link, hf CLI and curl.
- Browser
- Download file 307 Bytes
-
https://huggingface.co/spaces/pjpjq/perplexica-auth/resolve/main/src/lib/utils/formatHistory.ts
- Command line
-
hf download hf://spaces/pjpjq/perplexica-auth/src/lib/utils/formatHistory.ts
-
curl -L -o formatHistory.ts https://huggingface.co/spaces/pjpjq/perplexica-auth/resolve/main/src/lib/utils/formatHistory.ts
307 Bytes
| import { ChatTurnMessage } from '../types'; | |
| const formatChatHistoryAsString = (history: ChatTurnMessage[]) => { | |
| return history | |
| .map( | |
| (message) => | |
| `${message.role === 'assistant' ? 'AI' : 'User'}: ${message.content}`, | |
| ) | |
| .join('\n'); | |
| }; | |
| export default formatChatHistoryAsString; | |