-
Notifications
You must be signed in to change notification settings - Fork 2.4k
refactor: refactor app entities #626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
dd10b23
refactor: app entities
louis-jan dd1f8c7
refactor: entities references & logics
louis-jan 43ec926
fix: model download state is not updated accordingly
louis-jan 6cff6d8
chore: update convo last message
louis-jan 9e77367
chore: remove unused types
louis-jan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,140 +1,183 @@ | ||
| export interface Conversation { | ||
| id: string; | ||
| modelId?: string; | ||
| botId?: string; | ||
| name: string; | ||
| message?: string; | ||
| summary?: string; | ||
| createdAt?: string; | ||
| updatedAt?: string; | ||
| messages: Message[]; | ||
| lastMessage?: string; | ||
| } | ||
| /** | ||
| * Message Request and Response | ||
| * ============================ | ||
| * */ | ||
|
|
||
| export interface Message { | ||
| id: string; | ||
| message?: string; | ||
| user?: string; | ||
| createdAt?: string; | ||
| updatedAt?: string; | ||
| /** | ||
| * The role of the author of this message. | ||
| * @data_transfer_object | ||
| */ | ||
| export enum ChatCompletionRole { | ||
| System = "system", | ||
| Assistant = "assistant", | ||
| User = "user", | ||
| } | ||
|
|
||
| export interface RawMessage { | ||
| /** | ||
| * The `MessageRequest` type defines the shape of a new message request object. | ||
| * @data_transfer_object | ||
| */ | ||
| export type ChatCompletionMessage = { | ||
| /** The contents of the message. **/ | ||
| content?: string; | ||
| /** The role of the author of this message. **/ | ||
| role: ChatCompletionRole; | ||
| }; | ||
|
|
||
| /** | ||
| * The `MessageRequest` type defines the shape of a new message request object. | ||
| * @data_transfer_object | ||
| */ | ||
| export type MessageRequest = { | ||
| id?: string; | ||
| conversationId?: string; | ||
| user?: string; | ||
| avatar?: string; | ||
| message?: string; | ||
| /** The thread id of the message request. **/ | ||
| threadId?: string; | ||
| /** Messages for constructing a chat completion request **/ | ||
| messages?: ChatCompletionMessage[]; | ||
| }; | ||
|
|
||
| /** | ||
| * Thread and Message | ||
| * ======================== | ||
| * */ | ||
|
|
||
| /** | ||
| * The status of the message. | ||
| * @data_transfer_object | ||
| */ | ||
| export enum MessageStatus { | ||
| /** Message is fully loaded. **/ | ||
| Ready = "ready", | ||
| /** Message is not fully loaded. **/ | ||
| Pending = "pending", | ||
| } | ||
| /** | ||
| * The `ThreadMessage` type defines the shape of a thread's message object. | ||
| * @stored | ||
| */ | ||
| export type ThreadMessage = { | ||
| /** Unique identifier for the message, generated by default using the ULID method. **/ | ||
| id?: string; | ||
| /** Thread id, default is a ulid. **/ | ||
| threadId?: string; | ||
| /** The role of the author of this message. **/ | ||
| role?: ChatCompletionRole; | ||
| /** The content of this message. **/ | ||
| content?: string; | ||
| /** The status of this message. **/ | ||
| status: MessageStatus; | ||
| /** The timestamp indicating when this message was created, represented in ISO 8601 format. **/ | ||
| createdAt?: string; | ||
| }; | ||
|
|
||
| /** | ||
| * The `Thread` type defines the shape of a thread object. | ||
| * @stored | ||
| */ | ||
| export interface Thread { | ||
| /** Unique identifier for the thread, generated by default using the ULID method. **/ | ||
| id: string; | ||
| /** The summary of this thread. **/ | ||
| summary?: string; | ||
| /** The messages of this thread. **/ | ||
| messages: ThreadMessage[]; | ||
| /** The timestamp indicating when this thread was created, represented in ISO 8601 format. **/ | ||
| createdAt?: string; | ||
| /** The timestamp indicating when this thread was updated, represented in ISO 8601 format. **/ | ||
| updatedAt?: string; | ||
| } | ||
|
|
||
| export interface Model { | ||
| /** | ||
| * Combination of owner and model name. | ||
| * Being used as file name. MUST be unique. | ||
| * @deprecated This field is deprecated and should not be used. | ||
| * Read from model file instead. | ||
| */ | ||
| modelId?: string; | ||
| } | ||
|
|
||
| /** | ||
| * Model type defines the shape of a model object. | ||
| * @stored | ||
| */ | ||
| export interface Model { | ||
| /** Combination of owner and model name.*/ | ||
| id: string; | ||
| /** The name of the model.*/ | ||
| name: string; | ||
| quantMethod: string; | ||
| /** Quantization method name.*/ | ||
| quantizationName: string; | ||
| /** The the number of bits represents a number.*/ | ||
| bits: number; | ||
| /** The size of the model file in bytes.*/ | ||
| size: number; | ||
| /** The maximum RAM required to run the model in bytes.*/ | ||
| maxRamRequired: number; | ||
| /** The use case of the model.*/ | ||
| usecase: string; | ||
| /** The download link of the model.*/ | ||
| downloadLink: string; | ||
| modelFile?: string; | ||
| /** | ||
| * For tracking download info | ||
| */ | ||
| startDownloadAt?: number; | ||
| finishDownloadAt?: number; | ||
| productId: string; | ||
| productName: string; | ||
| /** The short description of the model.*/ | ||
| shortDescription: string; | ||
| /** The long description of the model.*/ | ||
| longDescription: string; | ||
| /** The avatar url of the model.*/ | ||
| avatarUrl: string; | ||
| /** The author name of the model.*/ | ||
| author: string; | ||
| /** The version of the model.*/ | ||
| version: string; | ||
| /** The origin url of the model repo.*/ | ||
| modelUrl: string; | ||
| createdAt: number; | ||
| updatedAt?: number; | ||
| status: string; | ||
| /** The timestamp indicating when this model was released.*/ | ||
| releaseDate: number; | ||
| /** The tags attached to the model description */ | ||
| tags: string[]; | ||
| } | ||
|
|
||
| /** | ||
| * Model type of the presentation object which will be presented to the user | ||
| * @data_transfer_object | ||
| */ | ||
| export interface ModelCatalog { | ||
| /** The unique id of the model.*/ | ||
| id: string; | ||
| /** The name of the model.*/ | ||
| name: string; | ||
| shortDescription: string; | ||
| /** The avatar url of the model.*/ | ||
| avatarUrl: string; | ||
| /** The short description of the model.*/ | ||
| shortDescription: string; | ||
| /** The long description of the model.*/ | ||
| longDescription: string; | ||
| /** The author name of the model.*/ | ||
| author: string; | ||
| /** The version of the model.*/ | ||
| version: string; | ||
| /** The origin url of the model repo.*/ | ||
| modelUrl: string; | ||
| createdAt: number; | ||
| updatedAt?: number; | ||
| status: string; | ||
| /** The timestamp indicating when this model was released.*/ | ||
| releaseDate: number; | ||
| /** The tags attached to the model description **/ | ||
| tags: string[]; | ||
|
|
||
| /** The available versions of this model to download. */ | ||
| availableVersions: ModelVersion[]; | ||
| } | ||
| /** | ||
| * Model type which will be stored in the database | ||
| * Model type which will be present a version of ModelCatalog | ||
| * @data_transfer_object | ||
| */ | ||
| export type ModelVersion = { | ||
| /** | ||
| * Combination of owner and model name. | ||
| * Being used as file name. Should be unique. | ||
| */ | ||
| id: string; | ||
| /** The name of this model version.*/ | ||
| name: string; | ||
| quantMethod: string; | ||
| /** The quantization method name.*/ | ||
| quantizationName: string; | ||
| /** The the number of bits represents a number.*/ | ||
| bits: number; | ||
| /** The size of the model file in bytes.*/ | ||
| size: number; | ||
| /** The maximum RAM required to run the model in bytes.*/ | ||
| maxRamRequired: number; | ||
| /** The use case of the model.*/ | ||
| usecase: string; | ||
| /** The download link of the model.*/ | ||
| downloadLink: string; | ||
| productId: string; | ||
| /** | ||
| * For tracking download state | ||
| */ | ||
| startDownloadAt?: number; | ||
| finishDownloadAt?: number; | ||
| }; | ||
|
|
||
| export interface ChatMessage { | ||
| id: string; | ||
| conversationId: string; | ||
| messageType: MessageType; | ||
| messageSenderType: MessageSenderType; | ||
| senderUid: string; | ||
| senderName: string; | ||
| senderAvatarUrl: string; | ||
| text: string | undefined; | ||
| imageUrls?: string[] | undefined; | ||
| createdAt: number; | ||
| status: MessageStatus; | ||
| } | ||
|
|
||
| export enum MessageType { | ||
| Text = "Text", | ||
| Image = "Image", | ||
| ImageWithText = "ImageWithText", | ||
| Error = "Error", | ||
| } | ||
|
|
||
| export enum MessageSenderType { | ||
| Ai = "assistant", | ||
| User = "user", | ||
| } | ||
|
|
||
| export enum MessageStatus { | ||
| Ready = "ready", | ||
| Pending = "pending", | ||
| } | ||
|
|
||
| export type ConversationState = { | ||
| hasMore: boolean; | ||
| waitingForResponse: boolean; | ||
| error?: Error; | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.