Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/dokploy/components/dashboard/settings/handle-ai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { api } from "@/utils/api";
const AI_PROVIDERS = [
{ name: "OpenAI", apiUrl: "https://api.openai.com/v1" },
{ name: "Anthropic", apiUrl: "https://api.anthropic.com/v1" },
{ name: "DeepSeek", apiUrl: "https://api.deepseek.com" },
{
name: "Google Gemini",
apiUrl: "https://generativelanguage.googleapis.com/v1beta",
Expand Down
2 changes: 1 addition & 1 deletion apps/dokploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"ws": "8.16.0",
"xterm-addon-fit": "^0.8.0",
"yaml": "2.8.1",
"zod": "^4.3.6",
"zod": "^4.4.3",
"zod-form-data": "^3.0.1"
},
"devDependencies": {
Expand Down
23 changes: 23 additions & 0 deletions apps/dokploy/server/api/routers/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,29 @@ export const aiRouter = createTRPCRouter({
owned_by: "minimax",
},
] as Model[];
case "deepseek": {
const defaults = [
{
id: "deepseek-v4-pro",
object: "model",
created: Date.now(),
owned_by: "deepseek",
},
{
id: "deepseek-v4-flash",
object: "model",
created: Date.now(),
owned_by: "deepseek",
},
] as Model[];
try {
response = await fetch(`${input.apiUrl}/models`, { headers });
if (!response.ok) return defaults;
} catch (e) {
return defaults;
}
break;
}
default:
if (!input.apiKey)
throw new TRPCError({
Expand Down
31 changes: 21 additions & 10 deletions packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
{
"name": "@dokploy/server",
"version": "1.0.0",
"main": "./src/index.ts",
"main": "./dist/index.js",
"type": "module",
"exports": {
".": "./src/index.ts",
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs.js"
},
"./db": {
"import": "./src/db/index.ts",
"import": "./dist/db/index.js",
"require": "./dist/db/index.cjs.js"
},
"./setup/*": {
"import": "./src/setup/*.ts",
"require": "./dist/setup/index.cjs.js"
"./*": {
"import": "./dist/*.js",
"require": "./dist/*.cjs"
},
"./dist": {
"import": "./dist/index.js",
"require": "./dist/index.cjs.js"
},
"./dist/db": {
"import": "./dist/db/index.js",
"require": "./dist/db/index.cjs.js"
},
"./constants": {
"import": "./src/constants/index.ts",
"require": "./dist/constants.cjs.js"
"./dist/db/schema": {
"import": "./dist/db/schema/index.js",
"require": "./dist/db/schema/index.cjs.js"
}
},
"scripts": {
Expand Down Expand Up @@ -84,7 +95,7 @@
"toml": "3.0.0",
"ws": "8.16.0",
"yaml": "2.8.1",
"zod": "^4.3.6"
"zod": "^4.4.3"
},
"devDependencies": {
"@types/adm-zip": "^0.5.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/server/scripts/switchToDist.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pkg.exports = {
require: "./dist/db/index.cjs.js",
},
"./*": {
import: "./dist/*",
import: "./dist/*.js",
require: "./dist/*.cjs",
},
"./dist": {
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/services/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const suggestVariants = async ({
}

const provider = selectAIProvider(aiSettings);
const model = provider(aiSettings.model);
const model = provider(aiSettings.model) as any;
Comment thread
bulutmuf marked this conversation as resolved.

let ip = "";
if (!IS_CLOUD) {
Expand Down
41 changes: 41 additions & 0 deletions packages/server/src/utils/ai/select-ai-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function getProviderName(apiUrl: string) {
if (apiUrl.includes("openrouter.ai")) return "openrouter";
if (apiUrl.includes("api.z.ai")) return "zai";
if (apiUrl.includes("api.minimax.io")) return "minimax";
if (apiUrl.includes("api.deepseek.com")) return "deepseek";
return "custom";
}

Expand Down Expand Up @@ -116,6 +117,46 @@ export function selectAIProvider(config: { apiUrl: string; apiKey: string }) {
Authorization: `Bearer ${config.apiKey}`,
},
});
case "deepseek":
return createOpenAICompatible({
name: "deepseek",
baseURL: config.apiUrl,
headers: {
Authorization: `Bearer ${config.apiKey}`,
},
fetch: async (url, init) => {
if (
init?.body &&
typeof init.body === "string" &&
url.toString().includes("/chat/completions")
) {
try {
const body = JSON.parse(init.body);
if (body.temperature === undefined) body.temperature = 1;
if (body.top_p === undefined) body.top_p = 1;

if (body.thinking !== undefined) {
if (
typeof body.thinking === "boolean" ||
typeof body.thinking === "string"
) {
const isEnabled =
body.thinking === true || body.thinking === "true";
body.thinking = { type: isEnabled ? "enabled" : "disabled" };
}
}
if (body.reasoning_effort) {
const effort = body.reasoning_effort.toLowerCase();
if (effort === "low" || effort === "medium")
body.reasoning_effort = "high";
else if (effort === "xhigh") body.reasoning_effort = "max";
}
init.body = JSON.stringify(body);
} catch (e) {}
}
return fetch(url, init);
},
});
case "custom":
return createOpenAICompatible({
name: "custom",
Expand Down
Loading