feat(翻译): sip翻译
deploy-hxtesting / build-and-deploy (push) Successful in 1m18s

This commit is contained in:
runny committed 2026-11-30 20:45:34 +08:00
1 parent 5583d7b74b
commit db8472bf28
15 files changed
+2260 -2

No files matched your search

@@ -268,6 +268,7 @@ func (s *agentService) CreateAgentEngine(
// capability independently of the existing SkillsEnabled execution gate.
s.registerSandboxShellIfAllowed(ctx, toolRegistry, sessionID, config)
s.registerSandboxFileTools(ctx, toolRegistry, sessionID, config)
s.registerXlsxTranslateTool(ctx, toolRegistry, sessionID, config, chatModel)
s.registerWebPageFiles(ctx, toolRegistry, config, sessionID, assistantMessageID)
attachmentReader := s.registerAttachmentReader(ctx, toolRegistry, config, sessionID)
// Advertise cached service summaries independently of @mentions. Concrete
@@ -649,6 +650,50 @@ func (s *agentService) registerSandboxFileTools(
}
}
// registerXlsxTranslateTool registers the SIP/SOP workbook translation tool
// for agents that allow it. The tool reads the uploaded workbook through the
// session sandbox and delivers the English deliverable through the artifact
// output directory, so it follows the same sandbox capability gate as the
// file primitives: no session workspace, no translation tool.
func (s *agentService) registerXlsxTranslateTool(
ctx context.Context,
toolRegistry *tools.ToolRegistry,
sessionID string,
config *types.AgentConfig,
chatModel chat.Chat,
) {
allowed := false
for _, name := range tools.EffectiveAllowedTools(config.AllowedTools) {
if name == tools.ToolXlsxTranslate {
allowed = true
break
}
}
if !allowed {
return
}
if chatModel == nil {
logger.Infof(ctx, "xlsx_translate withheld: session has no chat model to translate with")
return
}
sandboxMgr, err := s.resolveWorkspaceSandbox(ctx, sessionID, config)
if err != nil {
logger.Warnf(ctx, "Failed to resolve sandbox for xlsx_translate: %v", err)
return
}
if sandboxMgr == nil {
logger.Infof(ctx, "xlsx_translate withheld: session has no workspace sandbox to read attachments and deliver output")
return
}
store := sessionSandboxFileStore(sandboxMgr)
if store == nil {
logger.Infof(ctx, "xlsx_translate withheld: sandbox backend does not advertise session filesystem capability")
return
}
toolRegistry.RegisterTool(tools.NewXlsxTranslateTool(store, store, chatModel))
logger.Infof(ctx, "Registered xlsx_translate tool for session: %s", sessionID)
}
// registerSkillFileTools registers write_skill_file / edit_skill_file for the
// built-in skill installer, and for nothing else.
//