mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 20:34:28 +00:00
feat(agent): propagate autofill context from chat to autofill workflow
Add an optional 'context' parameter to the create_file and create_version agent tools so the chat agent can pass generation/source context (e.g. 'Generated using gemini') to the AI metadata autofill workflow. - Add Asset.autofillContext column, persisted in the same transaction as asset creation when context is provided - Add new list_autofill_fields agent tool exposing autofillable metadata fields (name, type, description, options) per project - Autofill workflow reads the stored context and includes it in the autofill AI prompt - Add short chat system-prompt guidance to use list_autofill_fields and pass <=50 word context when creating files/versions
This commit is contained in:
@@ -17,6 +17,14 @@ const createVersionSchema = Type.Object({
|
||||
description:
|
||||
'The absolute or relative local path to the file on disk. This parameter is required.',
|
||||
}),
|
||||
context: Type.Optional(
|
||||
Type.String({
|
||||
description:
|
||||
'Optional short context about this version and how it was generated (max 50 words, e.g. "Generated using gemini"). ' +
|
||||
'Passed to the AI metadata autofill workflow to fill fields that cannot be determined from file content alone. ' +
|
||||
'Check autofillable fields with list_autofill_fields first.',
|
||||
}),
|
||||
),
|
||||
})
|
||||
|
||||
export function createCreateVersionTool(userId: string): AgentTool<typeof createVersionSchema> {
|
||||
@@ -46,6 +54,7 @@ export function createCreateVersionTool(userId: string): AgentTool<typeof create
|
||||
name: path.basename(absolutePath),
|
||||
size: fileSize,
|
||||
contentType: mimeType,
|
||||
...(params.context ? { context: params.context } : {}),
|
||||
},
|
||||
userId,
|
||||
assetId: params.parent,
|
||||
|
||||
Reference in New Issue
Block a user