-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a192a07
commit 5aa12ce
Showing
12 changed files
with
118 additions
and
57 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Message, Model } from '@libertai/libertai-js'; | ||
import { UIPersona } from 'src/types/personas'; | ||
|
||
// TODO: clean this type and understand the added properties | ||
export type UIMessage = Message & { | ||
stopped?: boolean; | ||
error?: any; | ||
searchResults?: any; | ||
attachments?: any[]; | ||
author: 'user' | 'ai'; | ||
}; | ||
|
||
export type Chat = { | ||
id: string; | ||
title: string; | ||
username: string; | ||
tags: string[]; | ||
|
||
model: Model; | ||
persona: UIPersona; | ||
messages: UIMessage[]; | ||
createdAt: Date; | ||
}; | ||
export type MinimalChat = Pick<Chat, 'id' | 'title' | 'createdAt'> & Partial<Chat>; | ||
|
||
// eslint-disable-next-line no-unused-vars | ||
export type ChatMigration = (currentChat: Chat) => Chat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Persona } from '@libertai/libertai-js'; | ||
|
||
export type UIPersona = Persona & { | ||
id: string; | ||
avatar: { | ||
item_hash: string; | ||
ipfs_hash: string; | ||
}; | ||
name: string; | ||
allowEdit: boolean; | ||
hidden: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Chat, ChatMigration, UIMessage } from 'src/types/chats'; | ||
|
||
export const chat_1_add_message_author: ChatMigration = (currentChat: Chat) => { | ||
const messages = currentChat.messages.map((message): UIMessage => { | ||
if (message.role === 'user') { | ||
return { ...message, author: 'user' }; | ||
} | ||
return { ...message, author: 'ai' }; | ||
}); | ||
|
||
return { ...currentChat, messages }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { ChatMigration } from 'src/types/chats'; | ||
import { chat_1_add_message_author } from 'src/utils/migrations/chats/chat_0'; | ||
|
||
export const chatsMigrations: ChatMigration[] = [chat_1_add_message_author]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters