Skip to content

Comments

Docker服务下添加Web UI,增删改查端点等,反代后可跨域、跨物理机、服务器使用#64

Merged
lich0821 merged 10 commits intolich0821:masterfrom
ANIIAN91:docker-headless
Dec 15, 2025
Merged

Docker服务下添加Web UI,增删改查端点等,反代后可跨域、跨物理机、服务器使用#64
lich0821 merged 10 commits intolich0821:masterfrom
ANIIAN91:docker-headless

Conversation

@ANIIAN91
Copy link
Contributor

webui

Copilot AI review requested due to automatic review settings December 15, 2025 10:32
@ANIIAN91 ANIIAN91 changed the title Docker headless Docker服务下添加Web UI,增删改查端点等 Dec 15, 2025
@ANIIAN91 ANIIAN91 changed the title Docker服务下添加Web UI,增删改查端点等 Docker服务下添加Web UI,增删改查端点等,反代后可跨域、跨物理机、服务器使用 Dec 15, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request transforms ccNexus from a Wails desktop application into a headless HTTP service with Docker support and adds a comprehensive Web UI for management and monitoring. The version is bumped from 4.3.0 to 4.4.0.

Key Changes:

  • Headless Mode: New cmd/server/main.go entry point for running as a pure HTTP service without GUI
  • Docker Support: Complete containerization with Dockerfile, docker-compose.yml, and entrypoint script for easy deployment
  • Web UI: Embedded web-based admin dashboard for endpoint management, statistics, and real-time monitoring
  • API Improvements: Enhanced transformer support for function calling in OpenAI Responses, Gemini, and Claude APIs
  • Bug Fixes: PowerShell Core detection, UI styling improvements, and input token fallback for Claude transformers

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
docker-entrypoint.sh Shell script for container initialization with data directory checks
docker-compose.yml Docker Compose configuration for running ccNexus as a containerized service
Dockerfile Multi-stage Docker build for headless server with SQLite support
README_DOCKER.md Comprehensive documentation for Docker deployment and Web UI usage
app/cmd/server/main.go New headless server entry point with environment variable support
app/cmd/server/webui_plugin.go Plugin registration for Web UI routes
app/cmd/webui/* Complete Web UI implementation with API handlers and frontend assets
app/internal/transformer/convert/* Enhanced API transformations with function calling and thinking block support
app/internal/transformer/cc/claude.go Added input tokens fallback for Claude message_delta events
app/internal/terminal/launcher.go PowerShell Core (pwsh) detection for Windows terminal launching
app/internal/proxy/streaming.go Updated streaming handler to pass request body for token estimation
app/frontend/src/* UI improvements for model selection and theme support
app/wails.json Version bump to 4.4.0
Comments suppressed due to low confidence (1)

Dockerfile:2

  • The Dockerfile references Golang version 1.24 which does not exist. As of January 2025, the latest stable Go version is 1.23. This will cause build failures. Consider using a valid version like golang:1.23-alpine or golang:1.22-alpine.
FROM golang:1.24-alpine AS builder

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +55 to +56
<!-- Chart.js from CDN -->
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading Chart.js from a CDN creates a dependency on external infrastructure and can fail if the CDN is unavailable or blocked. For a headless Docker deployment, consider either bundling Chart.js locally or documenting this external dependency clearly in the README.

Suggested change
<!-- Chart.js from CDN -->
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
<!-- Chart.js (bundled locally) -->
<script src="/ui/js/vendor/chart.umd.min.js"></script>

Copilot uses AI. Check for mistakes.
// CORSMiddleware adds CORS headers to responses
func CORSMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CORS is configured to allow all origins with "*". This is a security risk in production environments as it allows any website to make requests to the API. Consider restricting this to specific trusted origins or making it configurable via environment variables.

Copilot uses AI. Check for mistakes.
Comment on lines +221 to +223
if req.Model != "" {
existing.Model = req.Model
}
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Model field is only updated if req.Model is non-empty, but existing.Remark is always overwritten (line 224). This inconsistency means users cannot clear the Model field while they can clear the Remark field. Consider using the same pattern for both fields or allowing explicit clearing of the Model field.

Suggested change
if req.Model != "" {
existing.Model = req.Model
}
existing.Model = req.Model

Copilot uses AI. Check for mistakes.
Comment on lines +141 to +167
new Chart(ctx, {
type: 'bar',
data: {
labels: endpoints,
datasets: [{
label: 'Requests',
data: requests,
backgroundColor: '#3b82f6',
borderColor: '#2563eb',
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: true,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true
}
}
}
});
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new Chart instance without destroying any previous chart can lead to memory leaks if renderChart is called multiple times (e.g., when the dashboard is re-rendered). Consider storing the chart instance and destroying it before creating a new one using chart.destroy().

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,177 @@
import { api } from '../api.js';
import { state } from '../state.js';
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import state.

Suggested change
import { state } from '../state.js';

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,330 @@
import { api } from '../api.js';
import { state } from '../state.js';
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import state.

Suggested change
import { state } from '../state.js';

Copilot uses AI. Check for mistakes.
…artWithMux undefined 的编译错误(主程序需要在已有 mux 上挂载 WebUI 时使用)
@lich0821 lich0821 merged commit 1ebe9cb into lich0821:master Dec 15, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants