diff --git a/Dockerfile b/Dockerfile index b7305a6..158a39f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,6 @@ RUN pnpm build # The base for mode ENVIRONMENT=prod FROM caddy:${CADDY_VERSION}-alpine as prod - # Workaround for https://github.com/alpinelinux/docker-alpine/issues/98#issuecomment-679278499 RUN sed -i 's/https/http/' /etc/apk/repositories \ && apk add --no-cache bash diff --git a/components.d.ts b/components.d.ts index 9ca68ad..41df77f 100644 --- a/components.d.ts +++ b/components.d.ts @@ -11,11 +11,11 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete'] ElButton: typeof import('element-plus/es')['ElButton'] ElCard: typeof import('element-plus/es')['ElCard'] ElCollapse: typeof import('element-plus/es')['ElCollapse'] ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] - ElInput: typeof import('element-plus/es')['ElInput'] ElPopover: typeof import('element-plus/es')['ElPopover'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/assets/icons/action.svg b/src/assets/icons/action.svg index 690bead..c094e4e 100644 --- a/src/assets/icons/action.svg +++ b/src/assets/icons/action.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/layout/components/Main/Task.vue b/src/layout/components/Main/Task.vue index 2a9137c..0ddcbc6 100644 --- a/src/layout/components/Main/Task.vue +++ b/src/layout/components/Main/Task.vue @@ -6,6 +6,7 @@ import api from '@/api' import { changeBriefs } from '@/utils/collaboration_Brief_FrontEnd.ts' const emit = defineEmits<{ + (e: 'search-start'): void (e: 'search', value: string): void }>() @@ -15,6 +16,8 @@ const searchValue = ref('') async function handleSearch() { try { + emit('search-start') + agentsStore.resetAgent() agentsStore.setAgentRawPlan({ loading: true }) const data = await api.generateBasePlan({ goal: searchValue.value, @@ -27,6 +30,31 @@ async function handleSearch() { agentsStore.setAgentRawPlan({ loading: false }) } } + +const restaurants = ref([ + '如何快速筛选慢性肾脏病药物潜在受试者?', + '如何补充“丹芍活血胶囊”不良反应数据?', + '如何快速研发用于战场失血性休克的药物?', + '二维材料的光电性质受哪些关键因素影响?', + '如何通过AI模拟的方法分析材料的微观结构?', + '如何分析获取液态金属热力学参数?', + '如何解决固态电池的成本和寿命难题?', + '如何解决船舶制造中的材料腐蚀难题?', + '如何解决船舶制造中流体模拟和建模优化难题?', +]) +const querySearch = (queryString: string, cb: (v: {value: string}[]) => void) => { + const results = queryString + ? restaurants.value.filter(createFilter(queryString)) + : restaurants.value + // call callback function to return suggestions + cb(results.map((item) => ({value: item}))) +} + +const createFilter = (queryString: string) => { + return (restaurant: string) => { + return restaurant.toLowerCase().includes(queryString.toLowerCase()) + } +} - + diff --git a/src/layout/components/Main/TaskTemplate/TaskResult/ExecutePlan.vue b/src/layout/components/Main/TaskTemplate/TaskResult/ExecutePlan.vue index d61cce9..1c3c03b 100644 --- a/src/layout/components/Main/TaskTemplate/TaskResult/ExecutePlan.vue +++ b/src/layout/components/Main/TaskTemplate/TaskResult/ExecutePlan.vue @@ -17,35 +17,66 @@ const md = new MarkdownIt({ typographer: true, }) -const data = computed(() => { +function sanitize(str?: string) { + if (!str) { + return '' + } + const html = md.render(str) + return DOMPurify.sanitize(html) +} + +interface Data { + Description: string + Content: string + LogNodeType: string +} +const data = computed(() => { for (const result of props.executePlans) { - if (result.NodeId === props.nodeId && result.ActionHistory) { + if (result.NodeId === props.nodeId) { + // LogNodeType 为 object直接渲染Content + if (result.LogNodeType === 'object') { + return { + Description: props.nodeId, + Content: sanitize(result.content), + LogNodeType: result.LogNodeType, + } + } + + if (!result.ActionHistory) { + return null + } + for (const action of result.ActionHistory) { if (action.ID === props.actionId) { - return action + return { + Description: action.Description, + Content: sanitize(action.Action_Result), + LogNodeType: result.LogNodeType, + } } } } } return null }) - -const action_Result = computed(() => { - const html = md.render(data.value?.Action_Result ?? '') - return DOMPurify.sanitize(html) -}) @@ -54,4 +85,16 @@ const action_Result = computed(() => { .card-item + .card-item { margin-top: 10px; } +.markdown-content { + :deep(code) { + display: block; + width: 100px; + max-width: 100%; + } + + :deep(pre) { + overflow-x: auto; + max-width: 100%; + } +} diff --git a/src/layout/components/Main/TaskTemplate/TaskResult/index.vue b/src/layout/components/Main/TaskTemplate/TaskResult/index.vue index 31aaac2..e73cbb9 100644 --- a/src/layout/components/Main/TaskTemplate/TaskResult/index.vue +++ b/src/layout/components/Main/TaskTemplate/TaskResult/index.vue @@ -8,11 +8,9 @@ import { getActionTypeDisplay, getAgentMapIcon } from '@/layout/components/confi import { type ConnectArg, Jsplumb } from '@/layout/components/Main/TaskTemplate/utils.ts' import variables from '@/styles/variables.module.scss' import { type IRawStepTask, useAgentsStore } from '@/stores' -import api, { type IExecuteRawResponse } from '@/api' +import api from '@/api' import ExecutePlan from './ExecutePlan.vue' -import Iod from './Iod.vue' - const emit = defineEmits<{ (e: 'refreshLine'): void @@ -21,6 +19,7 @@ const emit = defineEmits<{ const agentsStore = useAgentsStore() + const collaborationProcess = computed(() => { return agentsStore.agentRawPlan.data?.['Collaboration Process'] ?? [] }) @@ -99,13 +98,6 @@ function createInternalLine(id?: string) { const color = getActionTypeDisplay(i.ActionType)?.color ?? '' const sourceId = `task-results-${jitem.Id}-0-${i.ID}` const targetId = `task-results-${item.Id}-1` - // jsplumb.connect(sourceId, targetId, [AnchorLocations.Right, AnchorLocations.Right], { - // stops: [ - // [0, color], - // [1, color], - // ], - // transparent: sourceId !== id, - // }) arr.push({ sourceId, targetId, @@ -132,13 +124,6 @@ function createInternalLine(id?: string) { const color = getActionTypeDisplay(i.ActionType)?.color ?? '' const sourceId = `task-results-${item.Id}-0-${i.ID}` const targetId = `task-results-${item.Id}-0-${i2.ID}` - // jsplumb.connect(sourceId, targetId, [AnchorLocations.Right, AnchorLocations.Right], { - // stops: [ - // [0, color], - // [1, color], - // ], - // transparent: sourceId !== id, - // }) arr.push({ sourceId, targetId, @@ -160,12 +145,12 @@ function createInternalLine(id?: string) { jsplumb.repaintEverything() } -const results = ref([]) const loading = ref(false) async function handleRun() { try { loading.value = true - results.value = await api.executePlan(agentsStore.agentRawPlan.data!) + const d = await api.executePlan(agentsStore.agentRawPlan.data!) + agentsStore.setExecutePlan(d) } finally { loading.value = false } @@ -204,8 +189,13 @@ const handleMouseLeave = throttle(() => { } }, 100) +function clear() { + jsplumb.reset() +} + defineExpose({ createInternalLine, + clear, }) @@ -218,9 +208,19 @@ defineExpose({ - - - + + + @@ -233,6 +233,7 @@ defineExpose({
{{ item.StepName }}
- - - - - - -