diff --git a/makefile b/makefile index fdb2c68..cc626c3 100644 --- a/makefile +++ b/makefile @@ -22,6 +22,7 @@ DOCKER_TAG := $(DOCKER_REGISTRY):$(BUILD_TIME)-$(BRANCH_NAME) docker-build: @echo "Building Docker image with tag: $(DOCKER_TAG)" docker build -t $(DOCKER_TAG) . + docker push $(DOCKER_TAG) docker-push: docker-build @echo "Pushing Docker image: $(DOCKER_TAG)" diff --git a/types/rw_map.go b/types/rw_map.go index 3d29681..89bdfa1 100644 --- a/types/rw_map.go +++ b/types/rw_map.go @@ -77,20 +77,31 @@ func (m *RWMap[K, V]) Len() int { func LoadFromJsonString[K comparable, V any](m *RWMap[K, V], jsonStr string) error { m.mutex.Lock() defer m.mutex.Unlock() - m.data = make(map[K]V) - return common.Unmarshal([]byte(jsonStr), &m.data) + // 先尝试解析到临时 map,成功后再替换,避免解析失败时丢失原有数据 + tempData := make(map[K]V) + err := common.Unmarshal([]byte(jsonStr), &tempData) + if err != nil { + return err + } + m.data = tempData + return nil } // LoadFromJsonStringWithCallback loads a JSON string into the RWMap and calls the callback on success. func LoadFromJsonStringWithCallback[K comparable, V any](m *RWMap[K, V], jsonStr string, onSuccess func()) error { m.mutex.Lock() defer m.mutex.Unlock() - m.data = make(map[K]V) - err := common.Unmarshal([]byte(jsonStr), &m.data) - if err == nil && onSuccess != nil { + // 先尝试解析到临时 map,成功后再替换,避免解析失败时丢失原有数据 + tempData := make(map[K]V) + err := common.Unmarshal([]byte(jsonStr), &tempData) + if err != nil { + return err + } + m.data = tempData + if onSuccess != nil { onSuccess() } - return err + return nil } // MarshalJSONString returns the JSON string representation of the RWMap. diff --git a/web/src/pages/Home/HomePricingFilters.jsx b/web/src/pages/Home/HomePricingFilters.jsx index b3157b2..cfb443a 100644 --- a/web/src/pages/Home/HomePricingFilters.jsx +++ b/web/src/pages/Home/HomePricingFilters.jsx @@ -28,7 +28,7 @@ import { getLobeHubIcon } from '../../helpers'; // 与 model_meta.go ModelType 常量一致:1=Chat, 2=Image, 3=Audio, 4=Video, 5=Embedding, 6=Rerank, 7=Vision, 8=Other const MODEL_TYPE_LIST = [ - { value: 1, labelKey: '对话' }, + { value: 1, labelKey: '文本' }, { value: 2, labelKey: '图像' }, { value: 3, labelKey: '音频' }, { value: 4, labelKey: '视频' },