@@ -27,70 +27,70 @@ export async function generateWorkspaceContext(
2727 try {
2828 const [ wsRow , members , workflows , kbs , tables , files , credentials , recentTasks ] =
2929 await Promise . all ( [
30- db
31- . select ( { id : workspace . id , name : workspace . name , ownerId : workspace . ownerId } )
32- . from ( workspace )
33- . where ( eq ( workspace . id , workspaceId ) )
34- . limit ( 1 )
35- . then ( ( rows ) => rows [ 0 ] ?? null ) ,
36-
37- getUsersWithPermissions ( workspaceId ) ,
38-
39- db
40- . select ( {
41- id : workflow . id ,
42- name : workflow . name ,
43- description : workflow . description ,
44- isDeployed : workflow . isDeployed ,
45- lastRunAt : workflow . lastRunAt ,
46- } )
47- . from ( workflow )
48- . where ( eq ( workflow . workspaceId , workspaceId ) ) ,
49-
50- db
51- . select ( {
52- id : knowledgeBase . id ,
53- name : knowledgeBase . name ,
54- description : knowledgeBase . description ,
55- } )
56- . from ( knowledgeBase )
57- . where ( and ( eq ( knowledgeBase . workspaceId , workspaceId ) , isNull ( knowledgeBase . deletedAt ) ) ) ,
58-
59- db
60- . select ( {
61- id : userTableDefinitions . id ,
62- name : userTableDefinitions . name ,
63- description : userTableDefinitions . description ,
64- } )
65- . from ( userTableDefinitions )
66- . where ( eq ( userTableDefinitions . workspaceId , workspaceId ) ) ,
67-
68- listWorkspaceFiles ( workspaceId ) ,
69-
70- db
71- . select ( {
72- providerId : account . providerId ,
73- scope : account . scope ,
74- } )
75- . from ( account )
76- . where ( eq ( account . userId , userId ) ) ,
77-
78- db
79- . select ( {
80- id : copilotChats . id ,
81- title : copilotChats . title ,
82- updatedAt : copilotChats . updatedAt ,
83- } )
84- . from ( copilotChats )
85- . where (
86- and (
87- eq ( copilotChats . workspaceId , workspaceId ) ,
88- eq ( copilotChats . userId , userId ) ,
89- eq ( copilotChats . type , 'mothership' )
30+ db
31+ . select ( { id : workspace . id , name : workspace . name , ownerId : workspace . ownerId } )
32+ . from ( workspace )
33+ . where ( eq ( workspace . id , workspaceId ) )
34+ . limit ( 1 )
35+ . then ( ( rows ) => rows [ 0 ] ?? null ) ,
36+
37+ getUsersWithPermissions ( workspaceId ) ,
38+
39+ db
40+ . select ( {
41+ id : workflow . id ,
42+ name : workflow . name ,
43+ description : workflow . description ,
44+ isDeployed : workflow . isDeployed ,
45+ lastRunAt : workflow . lastRunAt ,
46+ } )
47+ . from ( workflow )
48+ . where ( eq ( workflow . workspaceId , workspaceId ) ) ,
49+
50+ db
51+ . select ( {
52+ id : knowledgeBase . id ,
53+ name : knowledgeBase . name ,
54+ description : knowledgeBase . description ,
55+ } )
56+ . from ( knowledgeBase )
57+ . where ( and ( eq ( knowledgeBase . workspaceId , workspaceId ) , isNull ( knowledgeBase . deletedAt ) ) ) ,
58+
59+ db
60+ . select ( {
61+ id : userTableDefinitions . id ,
62+ name : userTableDefinitions . name ,
63+ description : userTableDefinitions . description ,
64+ } )
65+ . from ( userTableDefinitions )
66+ . where ( eq ( userTableDefinitions . workspaceId , workspaceId ) ) ,
67+
68+ listWorkspaceFiles ( workspaceId ) ,
69+
70+ db
71+ . select ( {
72+ providerId : account . providerId ,
73+ scope : account . scope ,
74+ } )
75+ . from ( account )
76+ . where ( eq ( account . userId , userId ) ) ,
77+
78+ db
79+ . select ( {
80+ id : copilotChats . id ,
81+ title : copilotChats . title ,
82+ updatedAt : copilotChats . updatedAt ,
83+ } )
84+ . from ( copilotChats )
85+ . where (
86+ and (
87+ eq ( copilotChats . workspaceId , workspaceId ) ,
88+ eq ( copilotChats . userId , userId ) ,
89+ eq ( copilotChats . type , 'mothership' )
90+ )
9091 )
91- )
92- . orderBy ( desc ( copilotChats . updatedAt ) )
93- . limit ( 5 ) ,
92+ . orderBy ( desc ( copilotChats . updatedAt ) )
93+ . limit ( 5 ) ,
9494 ] )
9595
9696 const sections : string [ ] = [ ]
0 commit comments