|
@@ -191,6 +191,7 @@ const form = reactive({
|
|
|
name: '',
|
|
name: '',
|
|
|
avatar: '',
|
|
avatar: '',
|
|
|
instructions: '',
|
|
instructions: '',
|
|
|
|
|
+ description: '',
|
|
|
job: '',
|
|
job: '',
|
|
|
antiJobs: [] as string[],
|
|
antiJobs: [] as string[],
|
|
|
voice: '' as ''|'concise'|'casual'|'rigorous'|'custom',
|
|
voice: '' as ''|'concise'|'casual'|'rigorous'|'custom',
|
|
@@ -215,6 +216,7 @@ function applyGrokBotDraft(name: string, description: string, draft: NonNullable
|
|
|
importPreview.value = { name, description, draft }
|
|
importPreview.value = { name, description, draft }
|
|
|
if (name) form.name = name
|
|
if (name) form.name = name
|
|
|
form.instructions = draft.instructions
|
|
form.instructions = draft.instructions
|
|
|
|
|
+ form.description = description.slice(0, 500)
|
|
|
form.job = draft.job ?? ''
|
|
form.job = draft.job ?? ''
|
|
|
form.antiJobs = draft.antiJobs ?? []
|
|
form.antiJobs = draft.antiJobs ?? []
|
|
|
form.actBias = (draft.actBias ?? '') as typeof form.actBias
|
|
form.actBias = (draft.actBias ?? '') as typeof form.actBias
|
|
@@ -614,6 +616,7 @@ async function openDialog(kind: NonNullable<typeof dialog.value>, conversation =
|
|
|
name: '',
|
|
name: '',
|
|
|
avatar: kind === 'agent' ? encodeAgentAvatar(randomAgentIdentity('new-agent', '机器人')) : '',
|
|
avatar: kind === 'agent' ? encodeAgentAvatar(randomAgentIdentity('new-agent', '机器人')) : '',
|
|
|
instructions: '',
|
|
instructions: '',
|
|
|
|
|
+ description: '',
|
|
|
execution: 'profile' as 'profile'|'computer',
|
|
execution: 'profile' as 'profile'|'computer',
|
|
|
canManageTeam: false,
|
|
canManageTeam: false,
|
|
|
canCollaborate: true,
|
|
canCollaborate: true,
|
|
@@ -637,7 +640,7 @@ async function openDialog(kind: NonNullable<typeof dialog.value>, conversation =
|
|
|
const a = agents.value.find(a => a.id === conversation?.memberIds[0])
|
|
const a = agents.value.find(a => a.id === conversation?.memberIds[0])
|
|
|
if (!a) throw new Error('机器人不存在,请刷新后重试')
|
|
if (!a) throw new Error('机器人不存在,请刷新后重试')
|
|
|
Object.assign(form, a)
|
|
Object.assign(form, a)
|
|
|
- form.job ??= ''; form.antiJobs ??= []; form.voice ??= ''; form.voiceCustom ??= ''; form.actBias ??= ''
|
|
|
|
|
|
|
+ form.description ??= ''; form.job ??= ''; form.antiJobs ??= []; form.voice ??= ''; form.voiceCustom ??= ''; form.actBias ??= ''
|
|
|
form.source=JSON.stringify([a.nodeId,a.profile])
|
|
form.source=JSON.stringify([a.nodeId,a.profile])
|
|
|
if(a.remoteAgentId){
|
|
if(a.remoteAgentId){
|
|
|
const remote=(await apiRequest<{agents:Agent[]}>(`/api/app/nodes/${a.nodeId}/agents`)).agents.find(candidate=>candidate.id===a.remoteAgentId)
|
|
const remote=(await apiRequest<{agents:Agent[]}>(`/api/app/nodes/${a.nodeId}/agents`)).agents.find(candidate=>candidate.id===a.remoteAgentId)
|
|
@@ -667,9 +670,9 @@ function closeDialog() {
|
|
|
dialog.value = null
|
|
dialog.value = null
|
|
|
editingConversationId.value = ''
|
|
editingConversationId.value = ''
|
|
|
}
|
|
}
|
|
|
-function saveBotProfile(draft: Pick<typeof form, 'name'|'avatar'|'instructions'|'source'|'canManageTeam'|'canCollaborate'|'memoryEnabled'|'approvalPolicy'> & Partial<Pick<typeof form, 'job'|'antiJobs'|'voice'|'voiceCustom'|'actBias'>>) {
|
|
|
|
|
|
|
+function saveBotProfile(draft: Pick<typeof form, 'name'|'avatar'|'instructions'|'description'|'source'|'canManageTeam'|'canCollaborate'|'memoryEnabled'|'approvalPolicy'> & Partial<Pick<typeof form, 'job'|'antiJobs'|'voice'|'voiceCustom'|'actBias'>>) {
|
|
|
Object.assign(form, draft)
|
|
Object.assign(form, draft)
|
|
|
- form.job ??= ''; form.antiJobs ??= []; form.voice ??= ''; form.voiceCustom ??= ''; form.actBias ??= ''
|
|
|
|
|
|
|
+ form.description ??= ''; form.job ??= ''; form.antiJobs ??= []; form.voice ??= ''; form.voiceCustom ??= ''; form.actBias ??= ''
|
|
|
void save()
|
|
void save()
|
|
|
}
|
|
}
|
|
|
watch(
|
|
watch(
|
|
@@ -684,7 +687,7 @@ async function save() {
|
|
|
busy.value = true
|
|
busy.value = true
|
|
|
error.value = ''
|
|
error.value = ''
|
|
|
try {
|
|
try {
|
|
|
- const fields = { name: form.name, ...(isAgentDialog.value ? { avatar: form.avatar, canManageTeam: form.canManageTeam, approvalPolicy: form.approvalPolicy, execution:form.execution, ...(knowledgeEnabled.value ? { canCollaborate: form.canCollaborate, memoryEnabled: form.memoryEnabled } : {}) } : {}), instructions: form.instructions }
|
|
|
|
|
|
|
+ const fields = { name: form.name, ...(isAgentDialog.value ? { avatar: form.avatar, description: form.description.trim(), canManageTeam: form.canManageTeam, approvalPolicy: form.approvalPolicy, execution:form.execution, ...(knowledgeEnabled.value ? { canCollaborate: form.canCollaborate, memoryEnabled: form.memoryEnabled } : {}) } : {}), instructions: form.instructions }
|
|
|
const personaClears = { job: form.job.trim() ? form.job.trim() : null, antiJobs: form.antiJobs.length ? form.antiJobs : null, voice: form.voice || null, voiceCustom: form.voice === 'custom' && form.voiceCustom.trim() ? form.voiceCustom : null, actBias: form.actBias || null }
|
|
const personaClears = { job: form.job.trim() ? form.job.trim() : null, antiJobs: form.antiJobs.length ? form.antiJobs : null, voice: form.voice || null, voiceCustom: form.voice === 'custom' && form.voiceCustom.trim() ? form.voiceCustom : null, actBias: form.actBias || null }
|
|
|
const personaCreates = Object.fromEntries(Object.entries(personaClears).filter(([, value]) => value !== null && value !== undefined))
|
|
const personaCreates = Object.fromEntries(Object.entries(personaClears).filter(([, value]) => value !== null && value !== undefined))
|
|
|
if (isRemoteAgent.value) {
|
|
if (isRemoteAgent.value) {
|