* 完善所有用到的type对象,并添加中文注释

* 补充遗失的type
This commit is contained in:
xiaoFjun-eng
2026-05-19 09:05:04 +08:00
committed by GitHub
parent c499bfb4ed
commit ea399f1862
68 changed files with 986 additions and 208 deletions

View File

@@ -25,7 +25,8 @@ function isLargeOutputs(
let size = 0
for (const o of outputs) {
if (!o) continue
size += (o.text?.length ?? 0) + (o.image?.image_data.length ?? 0)
const imageLen = 'image' in o && o.image ? o.image.image_data.length : 0
size += (o.text?.length ?? 0) + imageLen
if (size > LARGE_OUTPUT_THRESHOLD) return true
}
return false
@@ -139,7 +140,7 @@ function cellOutputToToolResult(output: NotebookCellSourceOutput) {
type: 'text',
})
}
if (output.image) {
if ('image' in output && output.image) {
outputs.push({
type: 'image',
source: {