5d7c10aeab
- Updated runtime configuration to use __CS_AI_AGENT_WIDGET_CONFIG__ instead of __CS_AGENT_WIDGET_CONFIG__. - Changed message types in support host bridge from "cs-agent" to "cs-ai-agent". - Minified SDK script updated to reflect new AI agent naming conventions. - Adjusted scrollbar styles in main.scss to use .cs-ai-agent-scrollbar instead of .cs-agent-scrollbar.
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package builders
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"cs-ai-agent/internal/models"
|
|
"cs-ai-agent/internal/pkg/dto/response"
|
|
"cs-ai-agent/internal/pkg/enums"
|
|
)
|
|
|
|
func BuildSkillDefinitionResponse(item *models.SkillDefinition) response.SkillDefinitionResponse {
|
|
examples := make([]string, 0)
|
|
if raw := item.Examples; raw != "" {
|
|
_ = json.Unmarshal([]byte(raw), &examples)
|
|
}
|
|
toolWhitelist := make([]string, 0)
|
|
if raw := item.ToolWhitelist; raw != "" {
|
|
_ = json.Unmarshal([]byte(raw), &toolWhitelist)
|
|
}
|
|
return response.SkillDefinitionResponse{
|
|
ID: item.ID,
|
|
Code: item.Code,
|
|
Name: item.Name,
|
|
Description: item.Description,
|
|
Instruction: item.Instruction,
|
|
Examples: examples,
|
|
ToolWhitelist: toolWhitelist,
|
|
Status: int(item.Status),
|
|
StatusName: getSkillStatusName(item.Status),
|
|
Remark: item.Remark,
|
|
CreatedAt: item.CreatedAt,
|
|
UpdatedAt: item.UpdatedAt,
|
|
CreateUserName: item.CreateUserName,
|
|
UpdateUserName: item.UpdateUserName,
|
|
}
|
|
}
|
|
|
|
func getSkillStatusName(status enums.Status) string {
|
|
if label := enums.GetStatusLabel(status); label != "" {
|
|
return label
|
|
}
|
|
return "未知"
|
|
}
|