feat(ui): add necessary utils
This commit is contained in:
parent
5c313e9bed
commit
e29a08dc46
5 changed files with 150 additions and 0 deletions
9
ui/lib/utils/formatHistory.ts
Normal file
9
ui/lib/utils/formatHistory.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { BaseMessage } from '@langchain/core/messages';
|
||||
|
||||
const formatChatHistoryAsString = (history: BaseMessage[]) => {
|
||||
return history
|
||||
.map((message) => `${message._getType()}: ${message.content}`)
|
||||
.join('\n');
|
||||
};
|
||||
|
||||
export default formatChatHistoryAsString;
|
||||
Loading…
Add table
Add a link
Reference in a new issue