Merge branch 'main' of ssh://18.167.251.121:10002/aidlab/FiDA_Front

This commit is contained in:
X1627315083@163.com
2026-02-26 16:51:14 +08:00
8 changed files with 148 additions and 69 deletions

View File

@@ -10,6 +10,7 @@
<div class="agent-body flex-1 flex flex-col">
<List ref="listRef" :message-list="messageList" @regenerate="handleRegenerate" />
<Input
ref="inputRef"
is-agent-mode
:generating="isGenerating"
@send="handleSendMessage"
@@ -20,7 +21,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, computed, onUnmounted, onMounted, nextTick,watch } from 'vue'
import { ref, reactive, computed, onUnmounted, onMounted, nextTick, watch } from 'vue'
import List from './List.vue'
import Input from '../../components/Input.vue'
import { fetchAgentReply } from '@/api/agent'
@@ -45,6 +46,7 @@
const messageList = ref([])
const listRef = ref()
const inputRef = ref()
const isGenerating = ref(false)
const isPaused = ref(false) // 标记是否为主动暂停
const params = reactive<AgentParamsType>({
@@ -62,11 +64,15 @@
})
const sketchList = ref([])
watch(sketchList, (newVal) => {
console.log('添加图片链接--------');
emits('update:sketchList', newVal)
}, { deep: true })
watch(
sketchList,
(newVal) => {
console.log('添加图片链接--------')
emits('update:sketchList', newVal)
},
{ deep: true }
)
// 每次请求时创建新的 AbortController
let abort: AbortController
@@ -255,8 +261,8 @@ watch(sketchList, (newVal) => {
try {
const jsonData = JSON.parse(jsonText)
console.log('jsonData', jsonData);
console.log('jsonData', jsonData)
// 赋值 project_id 和 version_id
// if (jsonData.project_id) params.projectID = jsonData.project_id
// if (jsonData.version_id) params.versionID = jsonData.version_id
@@ -354,6 +360,10 @@ watch(sketchList, (newVal) => {
true
)
}
defineExpose({
inputRef
})
</script>
<style lang="less" scoped>

View File

@@ -76,8 +76,8 @@
// }
// return self.renderToken(tokens, idx, options, env, self)
// }
const str = md.render(props.content.text)
// console.log('str',str)
const str = md.render(props.content.text)
// console.log('str',str)
return str
})
@@ -167,10 +167,10 @@
border-radius: 50%;
}
}
.message-context{
line-height: 2rem;
font-size: 1.4rem;
}
.message-context {
line-height: 2rem;
font-size: 1.4rem;
}
}
.operate {
margin-top: 1.3rem;
@@ -215,3 +215,11 @@
}
}
</style>
<style lang="less">
.message-txt {
ul {
list-style-position: inside;
}
}
</style>

View File

@@ -19,8 +19,9 @@ const props = defineProps({
}
})
//const emit = defineEmits([
//])
const emit = defineEmits([
'restore'
])
const versionsList = ref([])
@@ -70,7 +71,8 @@ const openTree = (state)=>{
treeState.value = state
}
const versionRestore = ()=>{
const versionRestore = () => {
let id = ''
if(selectItem.value?.children?.length > 0){
function findMaxForYourFormat(items) {
@@ -99,6 +101,7 @@ const versionRestore = ()=>{
findAndAddChild(versionsList.value, selectItem.value?.versionId, addObj)
selectItem.value = {...addObj}
treeKey.value++
emit('restore')
}
const versionDelete = (versionDetail)=>{
if(!selectItem.value?.versionId)return

View File

@@ -4,12 +4,16 @@
<div class="btn" @click="versionTreeData.drawer = true">Version Tree</div>
</div>
<div class="content-wrapper">
<Agent :title="agentTitle" @update:sketchList="updateSketchList" />
<Agent ref="agentRef" :title="agentTitle" @update:sketchList="updateSketchList" />
<div class="preview-wrapper">
<Preview :type="previewType" :sketchList="sketchList" />
</div>
</div>
<VersionTreeIndex ref="VersionTreeIndexRef" v-model:versionTreeData="versionTreeData" />
<VersionTreeIndex
ref="VersionTreeIndexRef"
v-model:versionTreeData="versionTreeData"
@restore="handleRestore"
/>
</div>
</template>
@@ -21,12 +25,11 @@
import { useProjectStore } from '@/stores'
import { getProjectInfo } from '@/api/agent'
const agentTitle = ref('Retro Sofa Sketch')
const previewType = ref<'sketch' | 'report'>('sketch')
const VersionTreeIndexRef = ref()
const agentRef = ref()
const sketchList = ref([])
const updateSketchList = (newVal) => {
console.log('newVal', newVal)
@@ -35,21 +38,30 @@
}
const versionTreeData = ref({
drawer: false,
drawer: false
})
const handleRestore = () => {
console.log('-----------', agentRef.value.inputRef.addReportTag)
agentRef.value?.inputRef?.addReportTag('Restore')
}
const projectStore = useProjectStore()
watch(()=>projectStore.state.id, (newVal, oldVal) => {
if(newVal){
getProjectInfo({ id: newVal }).then(res => {
projectStore.setProject(res.project)
})
watch(
() => projectStore.state.id,
(newVal, oldVal) => {
if (newVal) {
getProjectInfo({ id: newVal }).then((res) => {
projectStore.setProject(res.project)
})
}
}
})
)
onMounted(()=>{
if(projectStore.state.id){
getProjectInfo({ id: projectStore.state.id }).then(res => {
onMounted(() => {
if (projectStore.state.id) {
getProjectInfo({ id: projectStore.state.id }).then((res) => {
projectStore.setProject(res.project)
})
}