Skip to content

Commit

Permalink
build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jorge-menjivar committed Dec 19, 2023
1 parent f527cc2 commit fb01c75
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"prettier": "^2.8.8",
"prettier-eslint": "^16.1.2",
"prettier-plugin-tailwindcss": "^0.2.8",
"supabase": "^1.113.2",
"supabase": "^1.123.4",
"tailwindcss": "^3.3.5",
"tsconfig": "workspace:*",
"typescript": "^5.2.2"
Expand Down
7 changes: 6 additions & 1 deletion apps/desktop/providers/messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,17 @@ export const MessagesProvider = ({
stream: ReadableStream | null;
controller: AbortController | null;
}> {
if (selectedConversation.model === null) {
error('No model selected');
return { stream: null, controller: null };
}

let customPrompt = selectedConversation.systemPrompt;

if (!selectedConversation.systemPrompt) {
customPrompt = builtInSystemPrompts.filter(
(prompt) =>
prompt.name === `${selectedConversation.model.vendor} Built-In`,
prompt.name === `${selectedConversation.model!.vendor} Built-In`,
)[0];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const supaCreateConversation = async (
{
id: newConversation.id,
name: newConversation.name,
model_id: newConversation.model.id,
model_id: newConversation.model?.id,
system_prompt_id: newConversation.systemPrompt?.id,
folder_id: newConversation.folderId,
timestamp: newConversation.timestamp,
Expand All @@ -38,7 +38,7 @@ export const supaUpdateConversation = async (
{
id: updatedConversation.id,
name: updatedConversation.name,
model_id: updatedConversation.model.id,
model_id: updatedConversation.model?.id,
system_prompt_id: updatedConversation.systemPrompt?.id,
folder_id: updatedConversation.folderId,
timestamp: updatedConversation.timestamp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const supaUpdateConversations = async (
.upsert({
id: conversation.id,
name: conversation.name,
model_id: conversation.model.id,
model_id: conversation.model?.id,
system_prompt_id: conversation.systemPrompt?.id || null,
folder_id: conversation.folderId,
timestamp: conversation.timestamp,
Expand Down
94 changes: 91 additions & 3 deletions apps/desktop/utils/app/storage/supabase/types/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface SupaDatabase {
Row: {
folder_id: string | null;
id: string;
model_id: string;
model_id: string | null;
name: string;
params: Json;
system_prompt_id: string | null;
Expand All @@ -24,7 +24,7 @@ export interface SupaDatabase {
Insert: {
folder_id?: string | null;
id?: string;
model_id: string;
model_id?: string | null;
name: string;
params?: Json;
system_prompt_id?: string | null;
Expand All @@ -35,7 +35,7 @@ export interface SupaDatabase {
Update: {
folder_id?: string | null;
id?: string;
model_id?: string;
model_id?: string | null;
name?: string;
params?: Json;
system_prompt_id?: string | null;
Expand Down Expand Up @@ -233,3 +233,91 @@ export interface SupaDatabase {
};
};
}

export type Tables<
PublicTableNameOrOptions extends
| keyof (SupaDatabase['public']['Tables'] & SupaDatabase['public']['Views'])
| { schema: keyof SupaDatabase },
TableName extends PublicTableNameOrOptions extends {
schema: keyof SupaDatabase;
}
? keyof (SupaDatabase[PublicTableNameOrOptions['schema']]['Tables'] &
SupaDatabase[PublicTableNameOrOptions['schema']]['Views'])
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof SupaDatabase }
? (SupaDatabase[PublicTableNameOrOptions['schema']]['Tables'] &
SupaDatabase[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends {
Row: infer R;
}
? R
: never
: PublicTableNameOrOptions extends keyof (SupaDatabase['public']['Tables'] &
SupaDatabase['public']['Views'])
? (SupaDatabase['public']['Tables'] &
SupaDatabase['public']['Views'])[PublicTableNameOrOptions] extends {
Row: infer R;
}
? R
: never
: never;

export type TablesInsert<
PublicTableNameOrOptions extends
| keyof SupaDatabase['public']['Tables']
| { schema: keyof SupaDatabase },
TableName extends PublicTableNameOrOptions extends {
schema: keyof SupaDatabase;
}
? keyof SupaDatabase[PublicTableNameOrOptions['schema']]['Tables']
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof SupaDatabase }
? SupaDatabase[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
Insert: infer I;
}
? I
: never
: PublicTableNameOrOptions extends keyof SupaDatabase['public']['Tables']
? SupaDatabase['public']['Tables'][PublicTableNameOrOptions] extends {
Insert: infer I;
}
? I
: never
: never;

export type TablesUpdate<
PublicTableNameOrOptions extends
| keyof SupaDatabase['public']['Tables']
| { schema: keyof SupaDatabase },
TableName extends PublicTableNameOrOptions extends {
schema: keyof SupaDatabase;
}
? keyof SupaDatabase[PublicTableNameOrOptions['schema']]['Tables']
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof SupaDatabase }
? SupaDatabase[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
Update: infer U;
}
? U
: never
: PublicTableNameOrOptions extends keyof SupaDatabase['public']['Tables']
? SupaDatabase['public']['Tables'][PublicTableNameOrOptions] extends {
Update: infer U;
}
? U
: never
: never;

export type Enums<
PublicEnumNameOrOptions extends
| keyof SupaDatabase['public']['Enums']
| { schema: keyof SupaDatabase },
EnumName extends PublicEnumNameOrOptions extends {
schema: keyof SupaDatabase;
}
? keyof SupaDatabase[PublicEnumNameOrOptions['schema']]['Enums']
: never = never,
> = PublicEnumNameOrOptions extends { schema: keyof SupaDatabase }
? SupaDatabase[PublicEnumNameOrOptions['schema']]['Enums'][EnumName]
: PublicEnumNameOrOptions extends keyof SupaDatabase['public']['Enums']
? SupaDatabase['public']['Enums'][PublicEnumNameOrOptions]
: never;
18 changes: 16 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fb01c75

Please sign in to comment.