This commit is contained in:
1 parent
2048251eff
commit
8c3d0ee31c
3 files changed
+14
-4
No files matched your search
@@ -98,7 +98,7 @@ templates:
|
|||||||
You are Academy SIP Translator, specialized in translating Chinese engineering Excel workbooks (SIP standard inspection procedures, SOP standard operating procedures, rack/enclosure manufacturing documents) into English.
|
You are Academy SIP Translator, specialized in translating Chinese engineering Excel workbooks (SIP standard inspection procedures, SOP standard operating procedures, rack/enclosure manufacturing documents) into English.
|
||||||
Workflow:
|
Workflow:
|
||||||
- When the user uploads a .xlsx workbook, call xlsx_translate: pass file_path set to the uploaded file's absolute sandbox path from <sandbox_attachments> when that section is present, otherwise pass attachment_name set to the uploaded file's name. Never ask the user to re-upload or to run any manual steps.
|
- When the user uploads a .xlsx workbook, call xlsx_translate: pass file_path set to the uploaded file's absolute sandbox path from <sandbox_attachments> when that section is present, otherwise pass attachment_name set to the uploaded file's name. Never ask the user to re-upload or to run any manual steps.
|
||||||
- After the tool returns, summarize the verification report for the user in their language: how many text units were translated, glossary hits, residual Chinese count, and the number/part integrity result. The translated workbook <original>_EN.xlsx is delivered automatically as a file card on this reply (and filed in the conversation artifact library) — tell the user to click that card to view details and download it. NEVER print raw API paths or URLs; always refer to the file by its name and the card on the reply.
|
- After the tool returns, summarize the verification report for the user in their language: how many text units were translated, glossary hits, residual Chinese count, and the number/part integrity result. The translated workbook <original>_EN.xlsx is delivered automatically as a clickable file link in the tool result (and filed in the conversation artifact library). Include that exact markdown link in your answer unchanged, so the user can click the file name to view details and download it. NEVER print raw API paths or URLs.
|
||||||
- If residual Chinese or integrity mismatches are reported, list the affected samples and recommend manual review of those entries; do not claim the deliverable is 100% complete when the report says otherwise.
|
- If residual Chinese or integrity mismatches are reported, list the affected samples and recommend manual review of those entries; do not claim the deliverable is 100% complete when the report says otherwise.
|
||||||
- If the tool reports an error (unsupported format, size limit, workspace unavailable), explain the exact cause and the fix (for example: re-save legacy .xls as .xlsx, or ask an administrator to enable the session workspace).
|
- If the tool reports an error (unsupported format, size limit, workspace unavailable), explain the exact cause and the fix (for example: re-save legacy .xls as .xlsx, or ask an administrator to enable the session workspace).
|
||||||
- Answer short questions about the translation approach (terminology control, placeholder protection for part numbers and tolerances, structure preservation) without calling tools; the translation itself always goes through xlsx_translate.
|
- Answer short questions about the translation approach (terminology control, placeholder protection for part numbers and tolerances, structure preservation) without calling tools; the translation itself always goes through xlsx_translate.
|
||||||
|
|||||||
@@ -206,12 +206,18 @@ func (t *XlsxTranslateTool) Execute(ctx context.Context, args json.RawMessage) (
|
|||||||
logger.Infof(ctx, "[Tool][XlsxTranslate] session=%s file=%s -> %s units=%d residual=%d llm_calls=%d",
|
logger.Infof(ctx, "[Tool][XlsxTranslate] session=%s file=%s -> %s units=%d residual=%d llm_calls=%d",
|
||||||
sessionID, source, deliverable, report.TranslatedUnits, report.ResidualCJKCount, report.LLMCalls)
|
sessionID, source, deliverable, report.TranslatedUnits, report.ResidualCJKCount, report.LLMCalls)
|
||||||
|
|
||||||
|
// The file name is written as a Markdown link whose destination is the
|
||||||
|
// canonical sandbox:<name> spelling. The stream handler rebinds that
|
||||||
|
// destination to the artifact's stable reference (resource:// handle, or
|
||||||
|
// sandbox:<name> without a catalog), so the file name inside the answer
|
||||||
|
// itself renders clickable — clicking opens the translated workbook.
|
||||||
|
fileLink := "[" + outName + "](sandbox:" + outName + ")"
|
||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
switch {
|
switch {
|
||||||
case len(outputLinks) > 0:
|
case len(outputLinks) > 0:
|
||||||
b.WriteString("Translation finished. The English workbook **" + outName + "** is saved in the output directory (available as a downloadable artifact).\n\n")
|
b.WriteString("Translation finished. The English workbook " + fileLink + " is saved in the output directory (available as a downloadable artifact).\n\n")
|
||||||
case attached:
|
case attached:
|
||||||
b.WriteString("Translation finished. The English workbook **" + outName + "** is attached to this reply as a file card — open it to see details and download.\n\n")
|
b.WriteString("Translation finished. The English workbook " + fileLink + " is attached to this reply — click the file name or the file card to view details and download.\n\n")
|
||||||
default:
|
default:
|
||||||
b.WriteString("Translation finished. Download the English workbook **" + outName + "** here: " + deliverable + "\n\n")
|
b.WriteString("Translation finished. Download the English workbook **" + outName + "** here: " + deliverable + "\n\n")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,8 +280,12 @@ func TestXlsxTranslateToolWithoutSandbox(t *testing.T) {
|
|||||||
if !result.Success {
|
if !result.Success {
|
||||||
t.Fatalf("tool failed: %s", result.Error)
|
t.Fatalf("tool failed: %s", result.Error)
|
||||||
}
|
}
|
||||||
|
wantLink := "[D4-A08AR12000002-A3-SIP_EN.xlsx](sandbox:D4-A08AR12000002-A3-SIP_EN.xlsx)"
|
||||||
|
if !strings.Contains(result.Output, wantLink) {
|
||||||
|
t.Fatalf("output missing clickable file link %s: %s", wantLink, result.Output)
|
||||||
|
}
|
||||||
if !strings.Contains(result.Output, "file card") {
|
if !strings.Contains(result.Output, "file card") {
|
||||||
t.Fatalf("output should point at the artifact card: %s", result.Output)
|
t.Fatalf("output should mention the file card: %s", result.Output)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := sink.messages["assistant-1"]
|
msg := sink.messages["assistant-1"]
|
||||||
|
|||||||
Reference in new issue
Block a user