Backend - controller/ratio_sync.go • Parse /api/pricing response and convert to ratio / price maps. • Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data. • Include confidence map when building differences and filter “same”/empty entries. - dto/ratio_sync.go • Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem. Frontend - ChannelSelectorModal.js • Re-implement with table layout, pagination, search, endpoint-type selector and mobile support. - UpstreamRatioSync.js • Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints. • Leverage ChannelSelectorModal’s pagination reset. - ChannelsTable.js – fix tag color for disabled status. - en.json – add translations for new UI labels. Motivation These changes let users sync model ratios / prices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package dto
|
|
|
|
type UpstreamDTO struct {
|
|
ID int `json:"id,omitempty"`
|
|
Name string `json:"name" binding:"required"`
|
|
BaseURL string `json:"base_url" binding:"required"`
|
|
Endpoint string `json:"endpoint"`
|
|
}
|
|
|
|
type UpstreamRequest struct {
|
|
ChannelIDs []int64 `json:"channel_ids"`
|
|
Upstreams []UpstreamDTO `json:"upstreams"`
|
|
Timeout int `json:"timeout"`
|
|
}
|
|
|
|
// TestResult 上游测试连通性结果
|
|
type TestResult struct {
|
|
Name string `json:"name"`
|
|
Status string `json:"status"`
|
|
Error string `json:"error,omitempty"`
|
|
}
|
|
|
|
// DifferenceItem 差异项
|
|
// Current 为本地值,可能为 nil
|
|
// Upstreams 为各渠道的上游值,具体数值 / "same" / nil
|
|
|
|
type DifferenceItem struct {
|
|
Current interface{} `json:"current"`
|
|
Upstreams map[string]interface{} `json:"upstreams"`
|
|
Confidence map[string]bool `json:"confidence"`
|
|
}
|
|
|
|
type SyncableChannel struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
BaseURL string `json:"base_url"`
|
|
Status int `json:"status"`
|
|
} |