mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-09 08:03:50 +00:00
fix(frontend): ai agent step nits (#6469)
* fix(frontend): ai agent step nits * fix provider select * nits * nit
This commit is contained in:
@@ -937,11 +937,21 @@
|
||||
selected={oneOfSelected}
|
||||
on:selected={({ detail }) => {
|
||||
oneOfSelected = detail
|
||||
const prevValueKeys = Object.keys(
|
||||
const selectedObjProperties =
|
||||
oneOf?.find((o) => o.title == detail)?.properties ?? {}
|
||||
)
|
||||
const newValueKeys = Object.keys(selectedObjProperties)
|
||||
const toKeep = {}
|
||||
for (const key of prevValueKeys) {
|
||||
for (const key of newValueKeys) {
|
||||
// Check if there is a select (enum) in the newly selected oneOf and if the current value is not in the enum, skip it
|
||||
if (
|
||||
!['kind', 'label'].includes(key) &&
|
||||
selectedObjProperties[key]?.enum &&
|
||||
value &&
|
||||
value[key] !== undefined &&
|
||||
!selectedObjProperties[key].enum.includes(value[key])
|
||||
) {
|
||||
continue
|
||||
}
|
||||
toKeep[key] = value[key]
|
||||
}
|
||||
const tagKey = oneOf.find((o) => Object.keys(o.properties ?? {}).includes('kind'))
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
You are a helpful AI assistant. You generate very brief summaries from scripts.
|
||||
The summaries need to be as short as possible (maximum 8 words) and only give a global idea. Do not specify the programming language. Do not use any punctation. Avoid using prepositions and articles.
|
||||
Examples: List the commits of a GitHub repository, Divide a number by 16, etc..
|
||||
**Return only the summary, no other text.**
|
||||
`,
|
||||
user: `
|
||||
Generate a very short summary for the script below:
|
||||
@@ -48,6 +49,7 @@ These descriptions are used to explain to other users what the script does and h
|
||||
Be as short as possible to give a global idea, maximum 3-4 sentences.
|
||||
All scripts export an asynchronous function called main, do not include it in the description.
|
||||
Do not describe how to call it either.
|
||||
**Return only the description, no other text.**
|
||||
`,
|
||||
user: `
|
||||
Generate a description for the script below:
|
||||
@@ -61,6 +63,7 @@ Generate a description for the script below:
|
||||
system: `
|
||||
You are a helpful AI assistant. You generate very brief summaries from scripts.
|
||||
The summaries need to be as short as possible (maximum 8 words) and only give a global idea. Do not use any punctation. Avoid using prepositions and articles.
|
||||
**Return only the summary, no other text.**
|
||||
`,
|
||||
user: `
|
||||
Summarize the flow below in one very short sentence without punctation:
|
||||
@@ -73,6 +76,7 @@ You are a helpful AI assistant. You generate descriptions from flow.
|
||||
These descriptions are used to explain to other users what the flow does and how to use it.
|
||||
Be as short as possible to give a global idea, maximum 3-4 sentences.
|
||||
Do not include line breaks.
|
||||
**Return only the description, no other text.**
|
||||
`,
|
||||
user: `
|
||||
Generate a description for the flow below:
|
||||
@@ -81,13 +85,15 @@ Generate a description for the flow below:
|
||||
},
|
||||
agentToolFunctionName: {
|
||||
system: `
|
||||
You are a helpful AI assistant. You generate function names from scripts.
|
||||
These function names will be used by an AI agent to call this tool.
|
||||
You are a helpful AI assistant. You generate tool names from scripts.
|
||||
These tool names will be used by an AI agent to call this tool.
|
||||
It has to be based on the script code content not on the main function name.
|
||||
It has to respect the following regex: /[a-zA-Z0-9_]+/
|
||||
Examples: generate_image, classify_image, summarize_text, etc.
|
||||
**Return only the tool name, no other text.**
|
||||
`,
|
||||
user: `
|
||||
Generate a function name for the script below:
|
||||
Generate a tool name for the script below:
|
||||
{code}`,
|
||||
placeholderName: 'code'
|
||||
}
|
||||
@@ -317,6 +323,11 @@ Generate a function name for the script below:
|
||||
on:focus={() => (focused = true)}
|
||||
on:blur={() => (focused = false)}
|
||||
/>
|
||||
{#if promptConfigName === 'agentToolFunctionName' && !validateToolName(content ?? '')}
|
||||
<div class="text-3xs text-red-400 absolute -bottom-4">
|
||||
Invalid tool name, should only contain letters, numbers and underscores
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
<!-- <slot {updateFocus} {active} {generatedContent} classNames={active ? '!indent-[8.8rem]' : ''} /> -->
|
||||
</div>
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="overflow-x-auto scrollbar-hidden flex items-center justify-between px-4 py-1 flex-nowrap"
|
||||
class="overflow-x-auto scrollbar-hidden flex items-center justify-between px-4 pt-1 pb-4 flex-nowrap"
|
||||
>
|
||||
{#if flowModuleValue}
|
||||
<span class="text-sm w-full mr-4">
|
||||
|
||||
@@ -106,7 +106,9 @@ export async function loadSchemaFromModule(module: FlowModule): Promise<{
|
||||
type: 'number'
|
||||
},
|
||||
temperature: {
|
||||
type: 'number'
|
||||
type: 'number',
|
||||
description:
|
||||
'Controls randomness in text generation. Range: 0.0 (deterministic) to 2.0 (random).'
|
||||
}
|
||||
},
|
||||
required: ['provider', 'model', 'user_message'],
|
||||
|
||||
Reference in New Issue
Block a user