mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-12 08:05:44 +00:00
fix: infer script arg schema when deploying via AI chat (#9356)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
da882c54b2
commit
4efc37212a
@@ -64,6 +64,7 @@ import {
|
||||
import type { ContextElement } from '../context'
|
||||
import { UserDraft, type UserDraftMeta } from '$lib/userDraft.svelte'
|
||||
import { emptySchema } from '$lib/utils'
|
||||
import { inferArgs } from '$lib/infer'
|
||||
import {
|
||||
resourceRequestSchema,
|
||||
scheduleRequestSchema,
|
||||
@@ -2746,10 +2747,16 @@ async function deployDraft(
|
||||
const existing = (await ScriptService.existsScriptByPath({ workspace, path }))
|
||||
? await ScriptService.getScriptByPath({ workspace, path })
|
||||
: undefined
|
||||
await ScriptService.createScript({
|
||||
workspace,
|
||||
requestBody: buildScriptDeployRequestBody(path, draft, existing, deploymentMessage)
|
||||
})
|
||||
const requestBody = buildScriptDeployRequestBody(path, draft, existing, deploymentMessage)
|
||||
// Infer the arg schema from the content so it matches the code, like the editor does.
|
||||
try {
|
||||
const schema = emptySchema()
|
||||
await inferArgs(requestBody.language, requestBody.content, schema)
|
||||
requestBody.schema = schema
|
||||
} catch (e) {
|
||||
console.error('Failed to infer script schema before deploy', e)
|
||||
}
|
||||
await ScriptService.createScript({ workspace, requestBody })
|
||||
break
|
||||
}
|
||||
case 'flow': {
|
||||
|
||||
Reference in New Issue
Block a user