feat(model): 添加流式配置支持并优化响应处理
This commit is contained in:
@@ -194,10 +194,10 @@ func fetchFileContent(ctx context.Context, client *http.Client, url string) (str
|
|||||||
return strings.TrimSpace(string(body)), nil
|
return strings.TrimSpace(string(body)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SkillMdContent 根据 skillName 获取 zip 内所有 md 文件拼接内容
|
|
||||||
func SkillMdContent(ctx context.Context, skillName string) string {
|
func SkillMdContent(ctx context.Context, skillName string) string {
|
||||||
skillResp, err := gateway.GetSkillUser(ctx, skillName)
|
skillResp, err := gateway.GetSkillUser(ctx, skillName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
g.Log().Warningf(ctx, "[SkillMd] GetSkillUser 失败: %v", err)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,11 +208,13 @@ func SkillMdContent(ctx context.Context, skillName string) string {
|
|||||||
|
|
||||||
zipBytes, err := downloadFile(client, fullUrl, maxSize)
|
zipBytes, err := downloadFile(client, fullUrl, maxSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
g.Log().Warningf(ctx, "[SkillMd] 下载失败 url=%s err=%v", fullUrl, err)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
mdContents, err := extractMdFiles(ctx, zipBytes)
|
mdContents, err := extractMdFiles(ctx, zipBytes)
|
||||||
if err != nil || len(mdContents) == 0 {
|
if err != nil || len(mdContents) == 0 {
|
||||||
|
g.Log().Warningf(ctx, "[SkillMd] 提取md失败 count=%d err=%v", len(mdContents), err)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user