mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
* feat(agent): create agents with a two-step setup wizard The create modal asks for a name and what the agent should do, then reviews instructions, how it starts, the identity it acts as, permissions and extras. The choices are applied through the endpoints Configuration uses; a choice that can't be applied is reported and the agent still opens. The Run as dropdown can also create an identity. Application types supply their create modal through getCreateModalComponent. * feat(agent): add tools, model and identity choices to the create wizard The wizard gains a third screen for the provider, model, reasoning effort and web search. Review can create an identity and pick tools one by one. Each suggestion now fills the whole setup: how the agent starts, its schedule, permissions, web search and actions. A new endpoint lists the tools an agent created in a workspace can be given, so they can be picked before the agent exists. The provider, model and effort fields are one component shared by Configuration and the wizard. * fix(agent): choose the wizard identity role from workspace tools * fix(agent): address create wizard review Skip locked tools in the permission presets, create the identity before the agent so a rejected name stops the wizard, number suggestion names, select the prefilled name, report models that can't search the web, show a failed tools request and fix the Read only icon. * fix(agent): address second create wizard review Give a new identity Builder when the agent may change data, reuse the identity a failed create made, explain why web search stays off and pass the workspace to the tool picker.
86 lines
2.4 KiB
Vue
86 lines
2.4 KiB
Vue
<template>
|
|
<p class="agent-create__intro">{{ $t('agent.setupModelIntro') }}</p>
|
|
<AgentModelFields
|
|
:values="modelValues"
|
|
:enabled-models="enabledModels"
|
|
:error-messages="errorMessages"
|
|
@change="changeModel"
|
|
/>
|
|
<AgentWebSearchSetting
|
|
class="agent-create__section"
|
|
:configuration="webSearchConfiguration"
|
|
editable
|
|
@change="update({ webSearch: $event })"
|
|
/>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import AgentModelFields from '@baserow/modules/agent/components/AgentModelFields'
|
|
import AgentWebSearchSetting from '@baserow/modules/agent/components/configuration/AgentWebSearchSetting'
|
|
import {
|
|
SETUP_ACTS_AS,
|
|
setupEnabledModels,
|
|
setupTools,
|
|
} from '@baserow/modules/agent/utils/agentSetup'
|
|
|
|
const SETUP_FIELDS = {
|
|
provider_type: 'providerType',
|
|
model_identifier: 'modelIdentifier',
|
|
reasoning_effort: 'reasoningEffort',
|
|
}
|
|
|
|
const props = defineProps({
|
|
modelValue: { type: Object, required: true },
|
|
workspace: { type: Object, required: true },
|
|
availableTools: { type: Array, required: true },
|
|
})
|
|
const emit = defineEmits(['update:modelValue'])
|
|
const { t } = useI18n()
|
|
|
|
const enabledModels = computed(() => setupEnabledModels(props.workspace))
|
|
const modelValues = computed(() =>
|
|
Object.fromEntries(
|
|
Object.entries(SETUP_FIELDS).map(([field, key]) => [
|
|
field,
|
|
props.modelValue[key],
|
|
])
|
|
)
|
|
)
|
|
const errorMessages = computed(() =>
|
|
props.modelValue.providerType && !props.modelValue.modelIdentifier
|
|
? { model_identifier: t('error.requiredField') }
|
|
: {}
|
|
)
|
|
const hasIdentity = computed(
|
|
() => props.modelValue.actsAs.kind !== SETUP_ACTS_AS.NONE
|
|
)
|
|
// Whether a model can search is only known once saved, so the switch stays usable.
|
|
const webSearchConfiguration = computed(() => ({
|
|
...modelValues.value,
|
|
web_search_enabled: props.modelValue.webSearch,
|
|
web_search_available: true,
|
|
web_search_blocked_by_tools: false,
|
|
run_as: hasIdentity.value ? props.modelValue.actsAs : null,
|
|
allowed_tools: hasIdentity.value
|
|
? setupTools(props.modelValue, props.availableTools).allowed_tools
|
|
: [],
|
|
}))
|
|
|
|
function update(values) {
|
|
emit('update:modelValue', { ...props.modelValue, ...values })
|
|
}
|
|
|
|
function changeModel(values) {
|
|
update(
|
|
Object.fromEntries(
|
|
Object.entries(values).map(([field, value]) => [
|
|
SETUP_FIELDS[field],
|
|
value,
|
|
])
|
|
)
|
|
)
|
|
}
|
|
</script>
|