From ea1f18cc74fefa5e9a61253f6882d617d1d1d92b Mon Sep 17 00:00:00 2001 From: Pascal Linxweiler Date: Tue, 6 Oct 2026 12:28:25 +0200 Subject: [PATCH] Deployments: API keys, deploy from the library, reorganized form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Settings → API keys (generate or paste, show again, delete). Deployments with "Require an API key" get them via LLAMA_API_KEY / VLLM_API_KEY (--api-key for several vLLM keys); values are masked in the stored/shown command and in logs. The chat proxy sends a key. - "Deploy" in the library and on the model page preselects the model and a runtime that can serve it; library rows and the model page link to the model's deployments. - Deployment form: grouped launch options with flags next to labels, command in its own step, extra arguments as flag/value rows (runtime form too). - Native selects follow the dark theme (color-scheme), fixing unreadable options. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 12 + drizzle/0012_api_keys.sql | 8 + drizzle/meta/0012_snapshot.json | 1523 +++++++++++++++++ drizzle/meta/_journal.json | 7 + src/app/(app)/[org]/[repo]/page.tsx | 45 +- .../deployments/[id]/deployment-detail.tsx | 23 +- src/app/(app)/deployments/deployment-form.tsx | 306 ++-- src/app/(app)/deployments/deployment-list.tsx | 36 +- src/app/(app)/deployments/form-data.ts | 8 +- src/app/(app)/deployments/new/page.tsx | 9 +- src/app/(app)/library-view.tsx | 38 +- .../settings/api-keys/api-key-settings.tsx | 172 ++ src/app/(app)/settings/api-keys/page.tsx | 10 + src/app/(app)/settings/layout.tsx | 3 +- .../(app)/settings/runtimes/runtime-form.tsx | 47 +- src/app/api/api-keys/[id]/route.ts | 29 + src/app/api/api-keys/route.ts | 19 + src/app/api/deployments/[id]/chat/route.ts | 6 +- src/app/globals.css | 7 + src/components/args-editor.tsx | 56 + src/components/ui/native-select.tsx | 21 + src/components/user-menu.tsx | 6 +- src/hooks/use-hostname.ts | 20 + src/lib/api-keys.ts | 67 + src/lib/db/schema.ts | 13 + src/lib/deploy-command.test.ts | 20 +- src/lib/deploy-command.ts | 21 +- src/lib/deployments.ts | 49 +- src/lib/extra-args.test.ts | 22 + src/lib/extra-args.ts | 24 + src/lib/library.ts | 6 + src/worker/deployments.ts | 28 +- 32 files changed, 2478 insertions(+), 183 deletions(-) create mode 100644 drizzle/0012_api_keys.sql create mode 100644 drizzle/meta/0012_snapshot.json create mode 100644 src/app/(app)/settings/api-keys/api-key-settings.tsx create mode 100644 src/app/(app)/settings/api-keys/page.tsx create mode 100644 src/app/api/api-keys/[id]/route.ts create mode 100644 src/app/api/api-keys/route.ts create mode 100644 src/components/args-editor.tsx create mode 100644 src/components/ui/native-select.tsx create mode 100644 src/hooks/use-hostname.ts create mode 100644 src/lib/api-keys.ts create mode 100644 src/lib/extra-args.test.ts create mode 100644 src/lib/extra-args.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index ea17fe4..df9d292 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,9 +28,21 @@ step 1 (Hugging Face downloader) is released as a minor version. traceback), followed by the last lines of output. - A deployment's vLLM data type replaces the runtime's `--dtype` instead of repeating the flag. - Models and runtimes used by a deployment can't be deleted until the deployment is. +- **API keys** (Settings → API keys): add generated or own keys, show and copy them again later. + A deployment with "Require an API key" accepts any of them (`LLAMA_API_KEY`, `VLLM_API_KEY` or + `--api-key` for several vLLM keys); the values are masked in the shown command and in the log, and + Kaname's own "Try it" chat sends one. Key changes apply when a deployment restarts. +- **Deploy from the library:** a "Deploy" button in the library and on the model page opens a new + deployment with the model and a fitting runtime preselected. The library and the model page link + to the deployments that use a model. +- Deployment form reorganized: launch options in groups (General, Context, Performance, KV cache, + Resources, Extra arguments) with each field's flag next to its label, the command in its own step, + and extra arguments as flag/value rows with "+ Add argument" (also in the runtime form). ### Fixed +- Dropdowns were unreadable in dark mode (white option list with light text): native controls now + follow the theme. - Image pulls showed "Starting · 0 B" until they finished: the worker's progress updates were never written (Drizzle queries only run when awaited). diff --git a/drizzle/0012_api_keys.sql b/drizzle/0012_api_keys.sql new file mode 100644 index 0000000..3d1f5d1 --- /dev/null +++ b/drizzle/0012_api_keys.sql @@ -0,0 +1,8 @@ +CREATE TABLE `api_keys` ( + `id` text PRIMARY KEY NOT NULL, + `name` text NOT NULL, + `key` text NOT NULL, + `created_at` integer NOT NULL +); +--> statement-breakpoint +CREATE UNIQUE INDEX `api_keys_key_unique` ON `api_keys` (`key`); \ No newline at end of file diff --git a/drizzle/meta/0012_snapshot.json b/drizzle/meta/0012_snapshot.json new file mode 100644 index 0000000..9039a2e --- /dev/null +++ b/drizzle/meta/0012_snapshot.json @@ -0,0 +1,1523 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "0d459c4f-2846-4f48-a248-25ef06279cb6", + "prevId": "4d24a2c4-682c-4a99-946f-ceb7fd1d1bae", + "tables": { + "api_keys": { + "name": "api_keys", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "api_keys_key_unique": { + "name": "api_keys_key_unique", + "columns": [ + "key" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "deployment_logs": { + "name": "deployment_logs", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ts": { + "name": "ts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stream": { + "name": "stream", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "line": { + "name": "line", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "deployment_logs_idx": { + "name": "deployment_logs_idx", + "columns": [ + "deployment_id", + "id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "deployment_logs_deployment_id_deployments_id_fk": { + "name": "deployment_logs_deployment_id_deployments_id_fk", + "tableFrom": "deployment_logs", + "tableTo": "deployments", + "columnsFrom": [ + "deployment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "deployments": { + "name": "deployments", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "runtime_id": { + "name": "runtime_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model_id": { + "name": "model_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "options": { + "name": "options", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cpus": { + "name": "cpus", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "memory_mb": { + "name": "memory_mb", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "host_port": { + "name": "host_port", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "desired_state": { + "name": "desired_state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'stopped'" + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'stopped'" + }, + "delete_requested_at": { + "name": "delete_requested_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "container_id": { + "name": "container_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "container_name": { + "name": "container_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "command": { + "name": "command", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_id": { + "name": "image_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "started_at": { + "name": "started_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ready_at": { + "name": "ready_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stopped_at": { + "name": "stopped_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "exit_code": { + "name": "exit_code", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stats": { + "name": "stats", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "deployments_runtime_id_runtimes_id_fk": { + "name": "deployments_runtime_id_runtimes_id_fk", + "tableFrom": "deployments", + "tableTo": "runtimes", + "columnsFrom": [ + "runtime_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployments_model_id_models_id_fk": { + "name": "deployments_model_id_models_id_fk", + "tableFrom": "deployments", + "tableTo": "models", + "columnsFrom": [ + "model_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "job_files": { + "name": "job_files", + "columns": { + "job_id": { + "name": "job_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model_file_id": { + "name": "model_file_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expected_bytes": { + "name": "expected_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "done_bytes": { + "name": "done_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + } + }, + "indexes": {}, + "foreignKeys": { + "job_files_job_id_jobs_id_fk": { + "name": "job_files_job_id_jobs_id_fk", + "tableFrom": "job_files", + "tableTo": "jobs", + "columnsFrom": [ + "job_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_files_model_file_id_model_files_id_fk": { + "name": "job_files_model_file_id_model_files_id_fk", + "tableFrom": "job_files", + "tableTo": "model_files", + "columnsFrom": [ + "model_file_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "job_files_job_id_model_file_id_pk": { + "columns": [ + "job_id", + "model_file_id" + ], + "name": "job_files_job_id_model_file_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "job_logs": { + "name": "job_logs", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "job_id": { + "name": "job_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ts": { + "name": "ts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stream": { + "name": "stream", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "line": { + "name": "line", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "job_logs_job_idx": { + "name": "job_logs_job_idx", + "columns": [ + "job_id", + "id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "job_logs_job_id_jobs_id_fk": { + "name": "job_logs_job_id_jobs_id_fk", + "tableFrom": "job_logs", + "tableTo": "jobs", + "columnsFrom": [ + "job_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "jobs": { + "name": "jobs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "model_id": { + "name": "model_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "purpose": { + "name": "purpose", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_sha": { + "name": "target_sha", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'queued'" + }, + "attempt": { + "name": "attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "total_bytes": { + "name": "total_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "done_bytes": { + "name": "done_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "speed_bps": { + "name": "speed_bps", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "eta_seconds": { + "name": "eta_seconds", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "exit_code": { + "name": "exit_code", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error_code": { + "name": "error_code", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "result": { + "name": "result", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cancel_requested_at": { + "name": "cancel_requested_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "started_at": { + "name": "started_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "finished_at": { + "name": "finished_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "jobs_state_idx": { + "name": "jobs_state_idx", + "columns": [ + "state" + ], + "isUnique": false + }, + "jobs_model_idx": { + "name": "jobs_model_idx", + "columns": [ + "model_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "jobs_model_id_models_id_fk": { + "name": "jobs_model_id_models_id_fk", + "tableFrom": "jobs", + "tableTo": "models", + "columnsFrom": [ + "model_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "local_folders": { + "name": "local_folders", + "columns": { + "path": { + "name": "path", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "files": { + "name": "files", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "file_count": { + "name": "file_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "total_bytes": { + "name": "total_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "commit": { + "name": "commit", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scanned_at": { + "name": "scanned_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "model_files": { + "name": "model_files", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "model_id": { + "name": "model_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "blob_oid": { + "name": "blob_oid", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lfs_sha256": { + "name": "lfs_sha256", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "selected": { + "name": "selected", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "checked_at": { + "name": "checked_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "model_files_model_path_uq": { + "name": "model_files_model_path_uq", + "columns": [ + "model_id", + "path" + ], + "isUnique": true + } + }, + "foreignKeys": { + "model_files_model_id_models_id_fk": { + "name": "model_files_model_id_models_id_fk", + "tableFrom": "model_files", + "tableTo": "models", + "columnsFrom": [ + "model_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "model_revisions": { + "name": "model_revisions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "model_id": { + "name": "model_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sha": { + "name": "sha", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "pinned_at": { + "name": "pinned_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "superseded_at": { + "name": "superseded_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "model_revisions_model_idx": { + "name": "model_revisions_model_idx", + "columns": [ + "model_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "model_revisions_model_id_models_id_fk": { + "name": "model_revisions_model_id_models_id_fk", + "tableFrom": "model_revisions", + "tableTo": "models", + "columnsFrom": [ + "model_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "model_tags": { + "name": "model_tags", + "columns": { + "model_id": { + "name": "model_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tag_id": { + "name": "tag_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "model_tags_tag_idx": { + "name": "model_tags_tag_idx", + "columns": [ + "tag_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "model_tags_model_id_models_id_fk": { + "name": "model_tags_model_id_models_id_fk", + "tableFrom": "model_tags", + "tableTo": "models", + "columnsFrom": [ + "model_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "model_tags_tag_id_tags_id_fk": { + "name": "model_tags_tag_id_tags_id_fk", + "tableFrom": "model_tags", + "tableTo": "tags", + "columnsFrom": [ + "tag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "model_tags_model_id_tag_id_pk": { + "columns": [ + "model_id", + "tag_id" + ], + "name": "model_tags_model_id_tag_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "models": { + "name": "models", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "repo_type": { + "name": "repo_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'model'" + }, + "repo_id": { + "name": "repo_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tracked_revision": { + "name": "tracked_revision", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'main'" + }, + "pinned_sha": { + "name": "pinned_sha", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "local_path": { + "name": "local_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "include_patterns": { + "name": "include_patterns", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[]'" + }, + "exclude_patterns": { + "name": "exclude_patterns", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[]'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "remote_sha": { + "name": "remote_sha", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_checked_at": { + "name": "last_checked_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_check_error": { + "name": "last_check_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hub_state": { + "name": "hub_state", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hub_missing_since": { + "name": "hub_missing_since", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "update_diff": { + "name": "update_diff", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_verified_at": { + "name": "last_verified_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "downloaded_at": { + "name": "downloaded_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "base_models": { + "name": "base_models", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "base_relation": { + "name": "base_relation", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "author_avatar_url": { + "name": "author_avatar_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "architecture": { + "name": "architecture", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pipeline_tag": { + "name": "pipeline_tag", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "license": { + "name": "license", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hub_tags": { + "name": "hub_tags", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata_fetched_at": { + "name": "metadata_fetched_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "models_repo_uq": { + "name": "models_repo_uq", + "columns": [ + "repo_type", + "repo_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "runtimes": { + "name": "runtimes", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "engine": { + "name": "engine", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "env": { + "name": "env", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'{}'" + }, + "extra_args": { + "name": "extra_args", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[]'" + }, + "devices": { + "name": "devices", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[]'" + }, + "shm_size_mb": { + "name": "shm_size_mb", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "numa_tuning": { + "name": "numa_tuning", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "preset": { + "name": "preset", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_state": { + "name": "image_state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'unknown'" + }, + "image_id": { + "name": "image_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_size": { + "name": "image_size", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_created": { + "name": "image_created", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pull_requested_at": { + "name": "pull_requested_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pull_started_at": { + "name": "pull_started_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pull_progress": { + "name": "pull_progress", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pull_error": { + "name": "pull_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_checked_at": { + "name": "image_checked_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "settings": { + "name": "settings", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tags": { + "name": "tags", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "tags_slug_uq": { + "name": "tags_slug_uq", + "columns": [ + "slug" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "worker_state": { + "name": "worker_state", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "instance_id": { + "name": "instance_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pid": { + "name": "pid", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hf_version": { + "name": "hf_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "models_dir_free_bytes": { + "name": "models_dir_free_bytes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "models_dir_total_bytes": { + "name": "models_dir_total_bytes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "started_at": { + "name": "started_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "heartbeat_at": { + "name": "heartbeat_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scan_requested_at": { + "name": "scan_requested_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "docker": { + "name": "docker", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index d902789..fc21ded 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -85,6 +85,13 @@ "when": 1791278463453, "tag": "0011_deployments", "breakpoints": true + }, + { + "idx": 12, + "version": "6", + "when": 1791281615301, + "tag": "0012_api_keys", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/app/(app)/[org]/[repo]/page.tsx b/src/app/(app)/[org]/[repo]/page.tsx index 9b19642..57c4326 100644 --- a/src/app/(app)/[org]/[repo]/page.tsx +++ b/src/app/(app)/[org]/[repo]/page.tsx @@ -9,6 +9,8 @@ import { LanguagesIcon, ListChecksIcon, MessagesSquareIcon, + PlusIcon, + RocketIcon, ScaleIcon, SparklesIcon, TriangleAlertIcon, @@ -17,12 +19,14 @@ import type { Metadata } from "next"; import Link from "next/link"; import { notFound, redirect } from "next/navigation"; import { CopyButton } from "@/components/copy-button"; +import { DeploymentStateBadge } from "@/components/deployment-state"; import { HubStateBadge } from "@/components/hub-state-badge"; import { LocalTime } from "@/components/local-time"; import { ModelStatusBadge } from "@/components/model-status-badge"; import { buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { formatBytes, shortSha } from "@/lib/format"; +import { deploymentsByModel, listDeployableModels } from "@/lib/deployments"; import { fetchModelCard } from "@/lib/hub/client"; import { modelFamilies } from "@/lib/hub/metadata"; import { listModelJobs } from "@/lib/jobs"; @@ -97,13 +101,17 @@ export default async function ModelPage({ params, searchParams }: PageProps<"/[o const hubTags = model.hubTags ?? []; const hubMissing = model.hubState === "repo_missing" || model.hubState === "commit_missing"; - const [tags, related, card, worker, recentJobs] = await Promise.all([ + const [tags, related, card, worker, recentJobs, byModel, deployable] = await Promise.all([ modelTagList(model.id), relatedModels(model.id, baseModels), tab === "card" ? fetchModelCard(model.repoId, model.pinnedSha).catch(() => undefined) : Promise.resolve(undefined), getWorkerStatus(), listModelJobs(model.id, 1), + deploymentsByModel(), + listDeployableModels(), ]); + const modelDeployments = byModel.get(model.id) ?? []; + const canDeploy = deployable.some((m) => m.id === model.id); const update = !hubMissing && model.updateDiff && model.updateDiff.sha === model.remoteSha && model.remoteSha !== model.pinnedSha ? model.updateDiff @@ -143,6 +151,15 @@ export default async function ModelPage({ params, searchParams }: PageProps<"/[o )}
+ {canDeploy && ( + + + Deploy + + )} + {(modelDeployments.length > 0 || canDeploy) && ( + +
+ {modelDeployments.length === 0 ? ( +

Not deployed yet.

+ ) : ( + modelDeployments.map((d) => ( + + + {d.name} + {d.runtimeName} + + + + )) + )} + {canDeploy && ( + + + New deployment + + )} +
+
+ )} +
Selection
diff --git a/src/app/(app)/deployments/[id]/deployment-detail.tsx b/src/app/(app)/deployments/[id]/deployment-detail.tsx index d6a575a..4fb51ab 100644 --- a/src/app/(app)/deployments/[id]/deployment-detail.tsx +++ b/src/app/(app)/deployments/[id]/deployment-detail.tsx @@ -3,7 +3,7 @@ import { ExternalLinkIcon, PencilIcon, PlayIcon, SendIcon, SquareIcon, Trash2Icon } from "lucide-react"; import Link from "next/link"; import { useRouter } from "next/navigation"; -import { useEffect, useRef, useState, useSyncExternalStore } from "react"; +import { useEffect, useRef, useState } from "react"; import { CopyButton } from "@/components/copy-button"; import { DeploymentStateBadge } from "@/components/deployment-state"; import { LocalTime } from "@/components/local-time"; @@ -21,6 +21,7 @@ import { import { Button, buttonVariants } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Progress } from "@/components/ui/progress"; +import { useHostname, webUiUrl } from "@/hooks/use-hostname"; import { ENGINE_PORT } from "@/lib/deploy-command"; import type { DeploymentRow } from "@/lib/deployments"; import { formatBytes, percent } from "@/lib/format"; @@ -67,15 +68,9 @@ export function DeploymentDetail({ initial }: { initial: Deployment }) { const startingSecs = d.state === "starting" && d.startedAt ? Math.max(0, (now - new Date(d.startedAt).getTime()) / 1000) : null; const port = ENGINE_PORT[d.engine]; const internal = d.containerName ? `http://${d.containerName}:${port}/v1` : null; - // The browser's host name (null while rendering on the server, so hydration matches). - const hostname = useSyncExternalStore( - () => () => {}, - () => window.location.hostname, - () => null, - ); + const hostname = useHostname(); const published = d.hostPort && hostname ? `http://${hostname}:${d.hostPort}/v1` : null; - // llama-server's built-in chat UI, served at / on the same port. - const webUi = d.engine === "llama.cpp" && d.options.webui !== false && d.hostPort && hostname ? `http://${hostname}:${d.hostPort}/` : null; + const webUi = webUiUrl(d, hostname); return (
@@ -218,6 +213,16 @@ export function DeploymentDetail({ initial }: { initial: Deployment }) { )} OpenAI-compatible; model name {d.repoId}. + {d.options.requireApiKey && ( + <> + {" "} + Requires one of the{" "} + + API keys + {" "} + as Authorization: Bearer. + + )} diff --git a/src/app/(app)/deployments/deployment-form.tsx b/src/app/(app)/deployments/deployment-form.tsx index 667830b..6a591db 100644 --- a/src/app/(app)/deployments/deployment-form.tsx +++ b/src/app/(app)/deployments/deployment-form.tsx @@ -1,19 +1,23 @@ "use client"; -import { BoxesIcon, CheckIcon, CpuIcon, SearchIcon } from "lucide-react"; +import { BoxesIcon, CheckIcon, SearchIcon, TerminalIcon } from "lucide-react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { toast } from "sonner"; +import { ArgsEditor } from "@/components/args-editor"; import { CopyButton } from "@/components/copy-button"; import { FileRoleBadge } from "@/components/labels"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; +import { NativeSelect } from "@/components/ui/native-select"; import type { DeploymentOptions, RuntimeEngine } from "@/lib/db/schema"; import type { ModelCandidates } from "@/lib/deploy-candidates"; -import { buildCommand, ENGINE_PORT, estimateMemoryMb, renderCommand } from "@/lib/deploy-command"; +import { API_KEY_PLACEHOLDER, buildCommand, ENGINE_PORT, estimateMemoryMb, renderCommand } from "@/lib/deploy-command"; +import { argsToRows, rowsToArgs } from "@/lib/extra-args"; import { formatBytes } from "@/lib/format"; import { quantGroup } from "@/lib/selection"; import { cn } from "@/lib/utils"; @@ -42,8 +46,6 @@ export type FormInitial = { const CONTEXT_PRESETS = [2048, 4096, 8192, 16384, 32768]; const KV_TYPES = ["f16", "q8_0", "q4_0"]; -const selectClass = - "h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 dark:bg-input/30"; const intOrNull = (s: string) => (s.trim() === "" ? null : Math.max(0, Math.round(Number(s)))) || null; const numOrNull = (s: string) => (s.trim() === "" ? null : Number(s)) || null; @@ -63,10 +65,41 @@ function Section({ step, title, description, children }: { step: number; title: ); } -function Field({ label, hint, children, htmlFor }: { label: string; hint?: React.ReactNode; children: React.ReactNode; htmlFor?: string }) { +/** A titled block of related options inside the launch options card. */ +function Group({ title, description, children }: { title: string; description?: string; children: React.ReactNode }) { return ( -
- +
+
+

{title}

+ {description &&

{description}

} +
+
{children}
+
+ ); +} + +/** `flag`: the command-line flag the field sets, shown next to the label. */ +function Field({ + label, + flag, + hint, + children, + htmlFor, + wide, +}: { + label: string; + flag?: string; + hint?: React.ReactNode; + children: React.ReactNode; + htmlFor?: string; + wide?: boolean; +}) { + return ( +
+
+ + {flag && {flag}} +
{children} {hint &&

{hint}

}
@@ -78,11 +111,13 @@ export function DeploymentForm({ runtimes, models, host, + apiKeyCount, initial, }: { runtimes: FormRuntime[]; models: FormModel[]; host: FormHost; + apiKeyCount: number; initial?: FormInitial; }) { const router = useRouter(); @@ -109,12 +144,13 @@ export function DeploymentForm({ const [cacheTypeV, setCacheTypeV] = useState(o?.cacheTypeV ?? ""); const [flashAttn, setFlashAttn] = useState(o?.flashAttn ?? ""); const [webui, setWebui] = useState(o?.webui !== false); + const [requireApiKey, setRequireApiKey] = useState(!!o?.requireApiKey); const [batchSize, setBatchSize] = useState(o?.batchSize != null ? String(o.batchSize) : ""); const [ubatchSize, setUbatchSize] = useState(o?.ubatchSize != null ? String(o.ubatchSize) : ""); const [dtype, setDtype] = useState(o?.dtype ?? ""); const [maxNumSeqs, setMaxNumSeqs] = useState(o?.maxNumSeqs != null ? String(o.maxNumSeqs) : ""); const [kvCacheGb, setKvCacheGb] = useState(o?.kvCacheGb != null ? String(o.kvCacheGb) : ""); - const [extraArgs, setExtraArgs] = useState((o?.extraArgs ?? []).join("\n")); + const [argRows, setArgRows] = useState(() => argsToRows(o?.extraArgs ?? [])); const [cpus, setCpus] = useState(initial?.cpus != null ? String(initial.cpus) : ""); const [memoryMb, setMemoryMb] = useState(initial?.memoryMb != null ? String(initial.memoryMb) : ""); const [memoryTouched, setMemoryTouched] = useState(!!initial?.memoryMb); @@ -144,13 +180,11 @@ export function DeploymentForm({ cacheTypeV: engine === "llama.cpp" && cacheTypeV ? cacheTypeV : null, flashAttn: engine === "llama.cpp" && flashAttn ? (flashAttn as "auto" | "on" | "off") : null, webui: engine === "llama.cpp" ? webui : null, + requireApiKey, dtype: engine === "vllm" && dtype ? dtype : null, maxNumSeqs: engine === "vllm" ? intOrNull(maxNumSeqs) : null, kvCacheGb: engine === "vllm" ? numOrNull(kvCacheGb) : null, - extraArgs: extraArgs - .split("\n") - .map((a) => a.trim()) - .filter(Boolean), + extraArgs: rowsToArgs(argRows), }; const fileBytes = model @@ -163,7 +197,13 @@ export function DeploymentForm({ const estimate = model ? estimateMemoryMb(fileBytes, options.contextSize, engine, options.kvCacheGb) : null; const memory = memoryTouched ? intOrNull(memoryMb) : estimate; const preview = - runtime && model ? renderCommand(runtime.image, buildCommand({ engine, options, model, runtime: { env: runtime.env, extraArgs: runtime.extraArgs } })) : null; + runtime && model ? renderCommand(runtime.image, buildCommand({ + engine, + options, + model, + runtime: { env: runtime.env, extraArgs: runtime.extraArgs }, + apiKeys: Array.from({ length: apiKeyCount }, () => API_KEY_PLACEHOLDER), + })) : null; const noBf16 = host && !host.cpuFeatures.includes("avx512_bf16"); async function submit(start: boolean) { @@ -302,7 +342,7 @@ export function DeploymentForm({ {model && engine === "llama.cpp" && (
- +
{model.candidates.gguf.map((g) => (
- - + - +
)} @@ -358,106 +399,152 @@ export function DeploymentForm({ {runtime && model && (
-
+ setName(e.target.value)} maxLength={80} /> - -
- setContextSize(e.target.value.replace(/\D/g, ""))} inputMode="numeric" className="w-24" /> -
- {CONTEXT_PRESETS.map((c) => ( - - ))} -
+ + setHostPort(e.target.value.replace(/\D/g, ""))} inputMode="numeric" placeholder="not published" /> + + + {engine === "llama.cpp" && ( + + )} + + + + +
+ setContextSize(e.target.value.replace(/\D/g, ""))} inputMode="numeric" className="w-28" /> + {CONTEXT_PRESETS.map((c) => ( + + ))}
- - {engine === "vllm" ? ( + {engine === "vllm" ? ( + setMaxNumSeqs(e.target.value.replace(/\D/g, ""))} inputMode="numeric" placeholder="default" /> - ) : ( + + ) : ( + setParallel(e.target.value.replace(/\D/g, ""))} inputMode="numeric" placeholder="auto" /> - )} - -
+
+ )} +
{engine === "llama.cpp" ? ( -
- + + setThreads(e.target.value.replace(/\D/g, ""))} inputMode="numeric" placeholder="auto" /> - -
- {[ - [cacheTypeK, setCacheTypeK], - [cacheTypeV, setCacheTypeV], - ].map(([value, set], i) => ( - - ))} -
-
- - + - :${hostPort}/` : "Needs a host port to open it (below).") : "--no-webui"}> - + + setBatchSize(e.target.value.replace(/\D/g, ""))} inputMode="numeric" placeholder="2048" /> - -
- setBatchSize(e.target.value.replace(/\D/g, ""))} inputMode="numeric" placeholder="2048" aria-label="Batch size" /> - setUbatchSize(e.target.value.replace(/\D/g, ""))} inputMode="numeric" placeholder="512" aria-label="Micro-batch size" /> -
+ + setUbatchSize(e.target.value.replace(/\D/g, ""))} inputMode="numeric" placeholder="512" /> -
+ ) : ( -
+ - + - - setKvCacheGb(e.target.value.replace(/[^\d.]/g, ""))} inputMode="decimal" placeholder={runtime.env.VLLM_CPU_KVCACHE_SPACE ?? "4"} /> - - - - -
+ )} -
- + + {engine === "llama.cpp" ? ( + <> + + setCacheTypeK(e.target.value)}> + + {KV_TYPES.filter((t) => t !== "f16").map((t) => ( + + ))} + + + + setCacheTypeV(e.target.value)}> + + {KV_TYPES.filter((t) => t !== "f16").map((t) => ( + + ))} + + + + ) : ( + + setKvCacheGb(e.target.value.replace(/[^\d.]/g, ""))} inputMode="decimal" placeholder={runtime.env.VLLM_CPU_KVCACHE_SPACE ?? "4"} /> + + )} + + + + setCpus(e.target.value.replace(/[^\d.]/g, ""))} inputMode="decimal" placeholder="no limit" /> @@ -481,35 +568,32 @@ export function DeploymentForm({ inputMode="numeric" /> - :/v1 (container port ${ENGINE_PORT[engine]}).`}> - setHostPort(e.target.value.replace(/\D/g, ""))} inputMode="numeric" placeholder="not published" /> - -
+ - -