feat:三个浮动窗口功能新增
This commit is contained in:
@@ -20,7 +20,7 @@ export function changeBriefs(task?: IRawStepTask[]): IRawStepTask[] {
|
||||
return task.map((item) => {
|
||||
const record = {
|
||||
...item,
|
||||
Collaboration_Brief_FrontEnd: changeBrief(item),
|
||||
Collaboration_Brief_frontEnd: changeBrief(item),
|
||||
}
|
||||
return record
|
||||
})
|
||||
@@ -30,10 +30,10 @@ function changeBrief(task: IRawStepTask): IRichText {
|
||||
// 如果不存在AgentSelection直接返回
|
||||
const agents = task.AgentSelection ?? []
|
||||
if (agents.length === 0) {
|
||||
return task.Collaboration_Brief_FrontEnd
|
||||
return task.Collaboration_Brief_frontEnd
|
||||
}
|
||||
const data: IRichText['data'] = {};
|
||||
let indexOffset = 0;
|
||||
const data: IRichText['data'] = {}
|
||||
let indexOffset = 0
|
||||
|
||||
// 根据InputObject_List修改
|
||||
const inputs = task.InputObject_List ?? []
|
||||
@@ -41,63 +41,62 @@ function changeBrief(task: IRawStepTask): IRichText {
|
||||
data[(index + indexOffset).toString()] = {
|
||||
text,
|
||||
style: { background: '#ACDBA0' },
|
||||
};
|
||||
return `!<${index + indexOffset}>!`;
|
||||
});
|
||||
const inputSentence = nameJoin(inputPlaceHolders);
|
||||
indexOffset += inputs.length;
|
||||
}
|
||||
return `!<${index + indexOffset}>!`
|
||||
})
|
||||
const inputSentence = nameJoin(inputPlaceHolders)
|
||||
indexOffset += inputs.length
|
||||
|
||||
// 根据AgentSelection修改
|
||||
// 根据AgentSelection修改
|
||||
const namePlaceholders = agents.map((text, index) => {
|
||||
data[(index + indexOffset).toString()] = {
|
||||
text,
|
||||
style: { background: '#E5E5E5', boxShadow: '1px 1px 4px 1px #0003' },
|
||||
};
|
||||
return `!<${index + indexOffset}>!`;
|
||||
});
|
||||
const nameSentence = nameJoin(namePlaceholders);
|
||||
indexOffset += agents.length;
|
||||
}
|
||||
return `!<${index + indexOffset}>!`
|
||||
})
|
||||
const nameSentence = nameJoin(namePlaceholders)
|
||||
indexOffset += agents.length
|
||||
|
||||
|
||||
let actionSentence = task.TaskContent ?? '';
|
||||
let actionSentence = task.TaskContent ?? ''
|
||||
|
||||
// delete the last '.' of actionSentence
|
||||
if (actionSentence[actionSentence.length - 1] === '.') {
|
||||
actionSentence = actionSentence.slice(0, -1);
|
||||
actionSentence = actionSentence.slice(0, -1)
|
||||
}
|
||||
const actionIndex = indexOffset++;
|
||||
const actionIndex = indexOffset++
|
||||
|
||||
data[actionIndex.toString()] = {
|
||||
text: actionSentence,
|
||||
style: { background: '#DDD', border: '1.5px solid #ddd' },
|
||||
};
|
||||
}
|
||||
|
||||
let outputSentence = '';
|
||||
const output = task.OutputObject ?? '';
|
||||
let outputSentence = ''
|
||||
const output = task.OutputObject ?? ''
|
||||
if (output) {
|
||||
data[indexOffset.toString()] = {
|
||||
text: output,
|
||||
style: { background: '#FFCA8C' },
|
||||
};
|
||||
outputSentence = `得到 !<${indexOffset}>!`;
|
||||
}
|
||||
outputSentence = `得到 !<${indexOffset}>!`
|
||||
}
|
||||
|
||||
// Join them togeter
|
||||
let content = inputSentence;
|
||||
let content = inputSentence
|
||||
if (content) {
|
||||
content = `基于${content}, ${nameSentence} 执行任务 !<${actionIndex}>!`;
|
||||
content = `基于${content}, ${nameSentence} 执行任务 !<${actionIndex}>!`
|
||||
} else {
|
||||
content = `${nameSentence} 执行任务 !<${actionIndex}>!`;
|
||||
content = `${nameSentence} 执行任务 !<${actionIndex}>!`
|
||||
}
|
||||
if (outputSentence) {
|
||||
content = `${content}, ${outputSentence}.`;
|
||||
content = `${content}, ${outputSentence}.`
|
||||
} else {
|
||||
content = `${content}.`;
|
||||
content = `${content}.`
|
||||
}
|
||||
content = content.trim();
|
||||
content = content.trim()
|
||||
|
||||
return {
|
||||
template: content,
|
||||
data,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user