@@ -12,8 +12,8 @@ import {
1212
1313export const aiModelEnum = pgEnum ( "ai_model_enum" , [
1414 "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5" ,
15- "mistralai/Mistral-7B-Instruct-v0.1" ,
1615 "meta-llama/Meta-Llama-3-8B-Instruct" ,
16+ "mistralai/Mistral-7B-Instruct-v0.1" ,
1717] ) ;
1818export const chatConversationMessageActorEnum = pgEnum (
1919 "chat_conversation_message_actor_enum" ,
@@ -35,39 +35,6 @@ export const chatConversation = pgTable("chat_conversation", {
3535 . references ( ( ) => neptunUser . id , { onDelete : "cascade" } ) ,
3636} ) ;
3737
38- export const chatConversationFile = pgTable ( "chat_conversation_file" , {
39- id : serial ( "id" ) . primaryKey ( ) . notNull ( ) ,
40- title : text ( "title" ) ,
41- language : text ( "language" ) . default ( "text" ) . notNull ( ) ,
42- fileExtension : text ( "file_extension" ) . default ( "txt" ) . notNull ( ) ,
43- text : text ( "text" ) . notNull ( ) ,
44- createdAt : timestamp ( "created_at" , { mode : "string" } ) . defaultNow ( ) ,
45- updatedAt : timestamp ( "updated_at" , { mode : "string" } ) . defaultNow ( ) ,
46- neptunUserId : integer ( "neptun_user_id" )
47- . notNull ( )
48- . references ( ( ) => neptunUser . id , { onDelete : "cascade" } ) ,
49- chatConversationId : integer ( "chat_conversation_id" )
50- . notNull ( )
51- . references ( ( ) => chatConversation . id , { onDelete : "cascade" } ) ,
52- chatConversationMessageId : integer ( "chat_conversation_message_id" )
53- . notNull ( )
54- . references ( ( ) => chatConversationMessage . id , { onDelete : "cascade" } ) ,
55- } ) ;
56-
57- export const chatConversationMessage = pgTable ( "chat_conversation_message" , {
58- id : serial ( "id" ) . primaryKey ( ) . notNull ( ) ,
59- message : text ( "message" ) . notNull ( ) ,
60- actor : chatConversationMessageActorEnum ( "actor" ) . default ( "user" ) . notNull ( ) ,
61- createdAt : timestamp ( "created_at" , { mode : "string" } ) . defaultNow ( ) ,
62- updatedAt : timestamp ( "updated_at" , { mode : "string" } ) . defaultNow ( ) ,
63- neptunUserId : integer ( "neptun_user_id" )
64- . notNull ( )
65- . references ( ( ) => neptunUser . id , { onDelete : "cascade" } ) ,
66- chatConversationId : integer ( "chat_conversation_id" )
67- . notNull ( )
68- . references ( ( ) => chatConversation . id , { onDelete : "cascade" } ) ,
69- } ) ;
70-
7138export const neptunUser = pgTable (
7239 "neptun_user" ,
7340 {
@@ -98,6 +65,38 @@ export const neptunUserOauthAccount = pgTable("neptun_user_oauth_account", {
9865 . references ( ( ) => neptunUser . id , { onDelete : "cascade" } ) ,
9966} ) ;
10067
68+ export const chatConversationMessage = pgTable ( "chat_conversation_message" , {
69+ id : serial ( "id" ) . primaryKey ( ) . notNull ( ) ,
70+ message : text ( "message" ) . notNull ( ) ,
71+ actor : chatConversationMessageActorEnum ( "actor" ) . default ( "user" ) . notNull ( ) ,
72+ createdAt : timestamp ( "created_at" , { mode : "string" } ) . defaultNow ( ) ,
73+ updatedAt : timestamp ( "updated_at" , { mode : "string" } ) . defaultNow ( ) ,
74+ neptunUserId : integer ( "neptun_user_id" )
75+ . notNull ( )
76+ . references ( ( ) => neptunUser . id , { onDelete : "cascade" } ) ,
77+ chatConversationId : integer ( "chat_conversation_id" )
78+ . notNull ( )
79+ . references ( ( ) => chatConversation . id , { onDelete : "cascade" } ) ,
80+ } ) ;
81+
82+ export const chatConversationFile = pgTable ( "chat_conversation_file" , {
83+ id : serial ( "id" ) . primaryKey ( ) . notNull ( ) ,
84+ createdAt : timestamp ( "created_at" , { mode : "string" } ) . defaultNow ( ) ,
85+ updatedAt : timestamp ( "updated_at" , { mode : "string" } ) . defaultNow ( ) ,
86+ neptunUserId : integer ( "neptun_user_id" )
87+ . notNull ( )
88+ . references ( ( ) => neptunUser . id , { onDelete : "cascade" } ) ,
89+ chatConversationId : integer ( "chat_conversation_id" )
90+ . notNull ( )
91+ . references ( ( ) => chatConversation . id , { onDelete : "cascade" } ) ,
92+ chatConversationMessageId : integer ( "chat_conversation_message_id" )
93+ . notNull ( )
94+ . references ( ( ) => chatConversationMessage . id , { onDelete : "cascade" } ) ,
95+ neptunUserFileId : integer ( "neptun_user_file_id" )
96+ . notNull ( )
97+ . references ( ( ) => neptunUserFile . id , { onDelete : "cascade" } ) ,
98+ } ) ;
99+
101100export const githubAppInstallation = pgTable ( "github_app_installation" , {
102101 id : serial ( "id" ) . primaryKey ( ) . notNull ( ) ,
103102 githubAccountType : text ( "github_account_type" ) . notNull ( ) ,
@@ -140,6 +139,24 @@ export const githubAppInstallationRepository = pgTable(
140139 } ,
141140) ;
142141
142+ export const neptunUserTemplate = pgTable ( "neptun_user_template" , {
143+ id : serial ( "id" ) . primaryKey ( ) . notNull ( ) ,
144+ description : text ( "description" ) ,
145+ fileName : text ( "file_name" ) . notNull ( ) ,
146+ createdAt : timestamp ( "created_at" , { mode : "string" } ) . defaultNow ( ) ,
147+ updatedAt : timestamp ( "updated_at" , { mode : "string" } ) . defaultNow ( ) ,
148+ neptunUserId : integer ( "neptun_user_id" )
149+ . notNull ( )
150+ . references ( ( ) => neptunUser . id , { onDelete : "cascade" } ) ,
151+ templateCollectionId : integer ( "template_collection_id" ) . references (
152+ ( ) => neptunUserTemplateCollection . id ,
153+ { onDelete : "cascade" } ,
154+ ) ,
155+ userFileId : integer ( "user_file_id" ) . references ( ( ) => neptunUserFile . id , {
156+ onDelete : "cascade" ,
157+ } ) ,
158+ } ) ;
159+
143160export const chatConversationShare = pgTable (
144161 "chat_conversation_share" ,
145162 {
@@ -166,6 +183,42 @@ export const chatConversationShare = pgTable(
166183 } ,
167184) ;
168185
186+ export const neptunUserFile = pgTable ( "neptun_user_file" , {
187+ id : serial ( "id" ) . primaryKey ( ) . notNull ( ) ,
188+ title : text ( "title" ) ,
189+ text : text ( "text" ) . notNull ( ) ,
190+ language : text ( "language" ) . default ( "text" ) . notNull ( ) ,
191+ fileExtension : text ( "file_extension" ) . default ( "txt" ) . notNull ( ) ,
192+ createdAt : timestamp ( "created_at" , { mode : "string" } ) . defaultNow ( ) ,
193+ updatedAt : timestamp ( "updated_at" , { mode : "string" } ) . defaultNow ( ) ,
194+ neptunUserId : integer ( "neptun_user_id" )
195+ . notNull ( )
196+ . references ( ( ) => neptunUser . id , { onDelete : "cascade" } ) ,
197+ } ) ;
198+
199+ export const neptunUserTemplateCollection = pgTable (
200+ "neptun_user_template_collection" ,
201+ {
202+ id : serial ( "id" ) . primaryKey ( ) . notNull ( ) ,
203+ name : text ( "name" ) . notNull ( ) ,
204+ description : text ( "description" ) ,
205+ isShared : boolean ( "is_shared" ) . default ( false ) . notNull ( ) ,
206+ shareId : uuid ( "share_id" ) . defaultRandom ( ) . notNull ( ) ,
207+ createdAt : timestamp ( "created_at" , { mode : "string" } ) . defaultNow ( ) ,
208+ updatedAt : timestamp ( "updated_at" , { mode : "string" } ) . defaultNow ( ) ,
209+ neptunUserId : integer ( "neptun_user_id" )
210+ . notNull ( )
211+ . references ( ( ) => neptunUser . id , { onDelete : "cascade" } ) ,
212+ } ,
213+ ( table ) => {
214+ return {
215+ neptunUserTemplateCollectionShareIdUnique : unique (
216+ "neptun_user_template_collection_share_id_unique" ,
217+ ) . on ( table . shareId ) ,
218+ } ;
219+ } ,
220+ ) ;
221+
169222export const chatConversationShareWhitelistEntry = pgTable (
170223 "chat_conversation_share_whitelist_entry" ,
171224 {
0 commit comments