new-api icon indicating copy to clipboard operation
new-api copied to clipboard

feat: ionet integrate

Open seefs001 opened this issue 6 months ago • 1 comments

Summary by CodeRabbit

  • New Features
    • Full model deployment suite: admin page, dashboard, create/edit flows, container management, logs, details, extend duration, batch actions.
    • Ollama model management: browse models, stream pull with progress, delete, and apply models from UI.
  • Improvements
    • IO.NET integration: provisioning, pricing, hardware/location selection, replica checks, enriched deployment metadata, and deployment↔channel linking.
    • UI: deployment menu, access guard, non-animated skeletons, new settings tab.
  • Documentation
    • Added IO.NET client/cluster name update snippet and model-deployment settings docs.
  • Tests & Chores
    • New unit tests for IO.NET client/container flows; updated dependencies and .dockerignore.

seefs001 avatar Oct 26 '25 05:10 seefs001

Walkthrough

Adds IoNet deployment support (client library, types, controllers, routes, frontend pages, hooks, modals, and tests) and Ollama model integration (relay, controller endpoints, SSE streaming, frontend modal). Also updates routing, sidebar, icons, i18n, go.mod, and minor UI presentation tweaks.

Changes

Cohort / File(s) Summary
Docker config
\.dockerignore
Adds /web/node_modules to ignored paths.
Go modules & docs
go.mod, docs/ionet-client.md
Adds test/dev dependencies and docs snippet for cluster name update.
Backend — channel / Ollama
controller/channel.go, relay/channel/ollama/dto.go, relay/channel/ollama/relay-ollama.go, router/api-router.go
Adds Ollama DTOs and relay functions (fetch, pull, stream, delete, version); controller handlers and routes for Ollama operations; adds OpenAIModel.Metadata field.
Backend — IoNet client core & types
pkg/ionet/types.go, pkg/ionet/client.go
New IO.NET client abstraction, HTTP interfaces, request execution, query param builder, API error parsing, and client constructors.
Backend — IoNet features
pkg/ionet/deployment.go, pkg/ionet/container.go, pkg/ionet/hardware.go, pkg/ionet/jsonutil.go
Implements deployment/container/hardware APIs, logs streaming/exec/restart/stop, price estimation, cluster name checks, and tolerant JSON time decoding.
Backend — ionet tests
pkg/ionet/*_test.go
Adds comprehensive unit tests for ionet client, deployment, container, and jsonutil.
Backend — deployment controller & routes
controller/deployment.go, router/api-router.go
New controller handlers for deployment lifecycle, logs, containers, hardware, locations, pricing, and admin /api/deployments group with many endpoints.
Backend — minor formatting
model/main.go
Formatting / indentation only.
Frontend — routing / sidebar / icons
web/src/App.jsx, web/src/components/layout/SiderBar.jsx, web/src/hooks/common/useSidebar.js, web/src/helpers/render.jsx
Adds /console/deployment route, admin menu item, default admin config includes deployment, and Server icon mapping.
Frontend — settings UI
web/src/pages/Setting/index.jsx, web/src/components/settings/ModelDeploymentSetting.jsx, web/src/pages/Setting/Model/SettingModelDeployment.jsx, web/src/pages/Setting/Operation/SettingsSidebarModulesAdmin.jsx, web/src/pages/Setting/Personal/SettingsSidebarModulesUser.jsx
New Model Deployment settings tab and components to enable IoNet and manage/test API key; sidebar defaults updated.
Frontend — access guard & page
web/src/pages/ModelDeployment/index.jsx, web/src/components/model-deployments/DeploymentAccessGuard.jsx
New guarded deployment page that checks feature enablement and shows guidance when disabled.
Frontend — deployments feature UI
web/src/components/table/model-deployments/*, web/src/components/table/model-deployments/modals/*, web/src/components/table/model-deployments/index.jsx
Implements full deployments UI: actions, filters, table, modals (Create/Edit/Extend/Update/ViewDetails/ViewLogs/ColumnSelector/Confirmation), helpers and page wiring.
Frontend — deployment hooks & actions
web/src/hooks/model-deployments/*
Hooks for resources, data, settings, and enhanced deployment actions (extend, logs, update, delete, export).
Frontend — Ollama modal & channel edits
web/src/components/table/channels/modals/OllamaModelModal.jsx, web/src/components/table/channels/modals/EditChannelModal.jsx, web/src/components/table/channels/modals/ModelSelectModal.jsx, web/src/components/table/channels/ChannelsColumnDefs.jsx, web/src/components/table/channels/ChannelsTable.jsx, web/src/hooks/channels/useChannelsData.jsx
New OllamaModelModal with model list/pull (SSE)/delete/apply; EditChannelModal integrates ionet metadata locking and Ollama modal; ModelSelectModal normalization updates; ChannelsColumnDefs shows ionet metadata and deployment link; channels hook exposes checkOllamaVersion.
Frontend — skeleton / presentation
web/src/components/layout/components/SkeletonWrapper.jsx
Removed Skeleton "active" animation prop from placeholders.
i18n
web/src/i18n/locales/{en,fr,ru,zh}.json
Adds many translation keys for Ollama, deployments, containers, pricing, logs, and related UI strings.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Web as Web UI
    participant API as Backend Controller
    participant Ionet as pkg/ionet Client
    participant IoNetSvc as IoNet Service

    User->>Web: Open Deployment page
    Web->>API: GET /api/deployments
    API->>Ionet: ListDeployments()
    Ionet->>IoNetSvc: GET /deployments
    IoNetSvc-->>Ionet: deployments
    Ionet-->>API: deployments
    API-->>Web: JSON list
    Web->>Web: Render deployments table
sequenceDiagram
    participant User
    participant Web as Web UI
    participant API as Channel Controller
    participant OllamaRelay as relay/channel/ollama
    participant OllamaSvc as Ollama Server

    User->>Web: Open OllamaModelModal
    Web->>API: GET /api/channel/fetch_models
    API->>OllamaRelay: FetchOllamaModels(baseURL, apiKey)
    OllamaRelay->>OllamaSvc: GET /api/tags
    OllamaSvc-->>OllamaRelay: models
    OllamaRelay-->>API: models
    API-->>Web: models

    User->>Web: Pull model (stream)
    Web->>API: POST /api/channel/ollama/pull/stream
    API->>OllamaRelay: PullOllamaModelStream(...)
    OllamaRelay->>OllamaSvc: POST /api/pull (Stream: true)
    OllamaSvc-->>OllamaRelay: SSE progress events
    OllamaRelay-->>API: progress events
    API-->>Web: SSE to client
    Web->>Web: Update progress UI

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Areas needing extra attention:

  • pkg/ionet/* (types, client, deployment, container, hardware, jsonutil) — API shapes, error handling, time parsing, and tests.
  • controller/deployment.go and new routes — authentication, input validation, ApiSuccess/ApiError consistency.
  • Frontend deployments feature — many interconnected components, forms, and modals with complex state flows.
  • SSE streaming path (relay → controller → frontend) — streaming parsing, cancellation/cleanup, and error propagation.
  • Channel ionet metadata locking and model-apply flows in EditChannelModal and ChannelsColumnDefs.

Possibly related PRs

  • QuantumNous/new-api#1940 — overlaps in fr.json translation additions and other i18n changes.
  • QuantumNous/new-api#1653 — related channel handler work (channel.go changes such as new channel handlers / metadata).
  • QuantumNous/new-api#1701 — related sidebar/useSidebar changes adding the deployment module.

Suggested reviewers

  • Calcium-Ion
  • creamlike1024

Poem

🐇 I hopped through code at dawn’s light,
I fetched Ollama tags and watched bytes flight,
IoNet clusters rose to greet the day,
Modals opened, logs and markets lay,
A rabbit cheers: "Deploy — hooray!"

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: ionet integrate' is concise and clearly indicates the main change—integration of IO.NET (ionet) functionality. It accurately reflects the substantial changeset adding ionet client APIs, deployment controllers, and UI components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Oct 26 '25 05:10 coderabbitai[bot]