File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
apps/dokploy/server/api/routers
packages/server/src/utils/ai Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ export const aiRouter = createTRPCRouter({
6262 case "ollama" :
6363 response = await fetch ( `${ input . apiUrl } /api/tags` , { headers } ) ;
6464 break ;
65+ case "gemini" :
66+ response = await fetch (
67+ `${ input . apiUrl } /models?key=${ encodeURIComponent ( input . apiKey ) } ` ,
68+ { headers : { } } ,
69+ ) ;
70+ break ;
6571 default :
6672 if ( ! input . apiKey )
6773 throw new TRPCError ( {
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export function getProviderName(apiUrl: string) {
1616 if ( apiUrl . includes ( "api.mistral.ai" ) ) return "mistral" ;
1717 if ( apiUrl . includes ( ":11434" ) || apiUrl . includes ( "ollama" ) ) return "ollama" ;
1818 if ( apiUrl . includes ( "api.deepinfra.com" ) ) return "deepinfra" ;
19+ if ( apiUrl . includes ( "generativelanguage.googleapis.com" ) ) return "gemini" ;
1920 return "custom" ;
2021}
2122
@@ -66,6 +67,13 @@ export function selectAIProvider(config: { apiUrl: string; apiKey: string }) {
6667 baseURL : config . apiUrl ,
6768 apiKey : config . apiKey ,
6869 } ) ;
70+ case "gemini" :
71+ return createOpenAICompatible ( {
72+ name : "gemini" ,
73+ baseURL : config . apiUrl ,
74+ queryParams : { key : config . apiKey } ,
75+ headers : { } ,
76+ } ) ;
6977 case "custom" :
7078 return createOpenAICompatible ( {
7179 name : "custom" ,
You can’t perform that action at this time.
0 commit comments