Skip to content

Conversation

@sjjy123
Copy link
Contributor

@sjjy123 sjjy123 commented Jan 6, 2026

Modelscope download and access

}

// NewModelscopeHandler 创建模型代理处理器实例
func NewModelscopeHandler(ModelscopeService *service.ModelscopeService) *ModelscopeHandler {
Copy link
Contributor

Choose a reason for hiding this comment

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

小写变量名

chunkSize: 8388608 # 8MB分块,16*1024*1024的数值结果
maxRetry: 5 # 超时重试次数
retryDelay: 3 # 重试间隔,单位秒(S)(原配置为5*time.Second,YAML中简化为数值+注释)
minFileSize: 1 # 最小缓存文件大小,单位字节(B)
Copy link
Contributor

Choose a reason for hiding this comment

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

参数去掉

webhook: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=73662ac1-1055-48a7-8c89-37964b5f4fdc111 # 企业微信机器人Webhook地址

modelscope:
modelCacheRoot: ./repos/modelscope/models # 模型缓存根目录
Copy link
Contributor

Choose a reason for hiding this comment

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

写到常量

func (h *ModelscopeHandler) ModelInfoHandler(c echo.Context) error {
parts := strings.Split(strings.Trim(c.Request().URL.Path, "/"), "/")

org, repo, repoType := parts[3], parts[4], parts[2]
Copy link
Contributor

Choose a reason for hiding this comment

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

判断长度

}

// createHTTPClient 创建宽松超时的HTTP客户端
func CreateHTTPClient() *http.Client {
Copy link
Contributor

Choose a reason for hiding this comment

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

共用一个client实例

readSize = int64(len(buf))
}

n, err := cacheFile.Read(buf[:readSize])
Copy link
Contributor

Choose a reason for hiding this comment

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

观察内存占用情况

Copy link
Contributor Author

Choose a reason for hiding this comment

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

经过测试同时读取8个本地10GB缓存文件数据,占用内存只有95.7MB

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.

2 participants