fix(@vben/web-antdv-next): clean AI template refs and index typing
- remove unused AI template refs - normalize document split and upload indexespull/369/head
parent
22ba329ad3
commit
5a21adf5bf
|
|
@ -22,8 +22,6 @@ const document = ref<null | {
|
|||
}[];
|
||||
title: string;
|
||||
}>(null); // 知识库文档列表
|
||||
const dialogVisible = ref(false); // 知识引用详情弹窗
|
||||
const documentRef = ref<HTMLElement>(); // 知识引用详情弹窗 Ref
|
||||
|
||||
/** 按照 document 聚合 segments */
|
||||
const documentList = computed(() => {
|
||||
|
|
@ -49,7 +47,6 @@ const documentList = computed(() => {
|
|||
/** 点击 document 处理 */
|
||||
function handleClick(doc: any) {
|
||||
document.value = doc;
|
||||
dialogVisible.value = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -79,7 +76,7 @@ function handleClick(doc: any) {
|
|||
</div>
|
||||
</div>
|
||||
<Tooltip placement="topLeft" :trigger="['click']">
|
||||
<div ref="documentRef"></div>
|
||||
<div></div>
|
||||
<template #title>
|
||||
<div class="mb-3 text-base font-bold">{{ document?.title }}</div>
|
||||
<div class="max-h-[60vh] overflow-y-auto">
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ const props = defineProps({
|
|||
});
|
||||
const emits = defineEmits(['onBtnClick', 'onMjBtnClick']);
|
||||
|
||||
const cardImageRef = ref<any>(); // 卡片 image ref
|
||||
|
||||
/** 处理点击事件 */
|
||||
async function handleButtonClick(type: string, detail: AiImageApi.Image) {
|
||||
emits('onBtnClick', type, detail);
|
||||
|
|
@ -110,7 +108,7 @@ onMounted(async () => {
|
|||
</div>
|
||||
|
||||
<!-- 图片展示区域 -->
|
||||
<div class="mt-5 h-72 flex-1 overflow-hidden" ref="cardImageRef">
|
||||
<div class="mt-5 h-72 flex-1 overflow-hidden">
|
||||
<Image class="w-full rounded-lg" :src="detail?.picUrl" />
|
||||
<div v-if="detail?.status === AiImageStatusEnum.FAIL">
|
||||
{{ detail?.errorMessage }}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ const queryParams = reactive({
|
|||
}); // 图片分页相关的参数
|
||||
const pageTotal = ref<number>(0); // page size
|
||||
const imageList = ref<AiImageApi.Image[]>([]); // image 列表
|
||||
const imageListRef = ref<any>(); // ref
|
||||
|
||||
const inProgressImageMap = ref<{}>({}); // 监听的 image 映射,一般是生成中(需要轮询),key 为 image 编号,value 为 image
|
||||
const inProgressTimer = ref<any>(); // 生成中的 image 定时器,轮询生成进展
|
||||
|
|
@ -192,7 +191,6 @@ onUnmounted(async () => {
|
|||
|
||||
<div
|
||||
class="flex flex-1 flex-wrap content-start overflow-y-auto p-3 pb-28 pt-5"
|
||||
ref="imageListRef"
|
||||
>
|
||||
<ImageCard
|
||||
v-for="image in imageList"
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ const currentFile = ref<any>(null); // 当前选中的文件
|
|||
const submitLoading = ref(false); // 提交按钮加载状态
|
||||
|
||||
/** 选择文件 */
|
||||
async function selectFile(index: number) {
|
||||
currentFile.value = modelData.value.list[index];
|
||||
async function selectFile(index: number | string) {
|
||||
currentFile.value = modelData.value.list[Number(index)];
|
||||
await splitContentFile(currentFile.value);
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +258,8 @@ onMounted(async () => {
|
|||
class="mb-2.5"
|
||||
>
|
||||
<div class="mb-1 text-sm text-gray-500">
|
||||
分片-{{ index + 1 }} · {{ segment.contentLength || 0 }} 字符数 ·
|
||||
分片-{{ Number(index) + 1 }} ·
|
||||
{{ segment.contentLength || 0 }} 字符数 ·
|
||||
{{ segment.tokens || 0 }} Token
|
||||
</div>
|
||||
<div class="rounded-md bg-card p-2">
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const formRef = ref(); // 表单引用
|
||||
const uploadRef = ref(); // 上传组件引用
|
||||
const parent = inject('parent', null); // 获取父组件实例
|
||||
const { uploadUrl, httpRequest } = useUpload(); // 使用上传组件的钩子
|
||||
const fileList = ref<UploadProps['fileList']>([]); // 文件列表
|
||||
|
|
@ -147,10 +145,10 @@ async function customRequest(info: UploadRequestOption) {
|
|||
*
|
||||
* @param index 要移除的文件索引
|
||||
*/
|
||||
function removeFile(index: number) {
|
||||
function removeFile(index: number | string) {
|
||||
// 从列表中移除文件
|
||||
const newList = [...props.modelValue.list];
|
||||
newList.splice(index, 1);
|
||||
newList.splice(Number(index), 1);
|
||||
// 更新表单数据
|
||||
emit('update:modelValue', {
|
||||
...props.modelValue,
|
||||
|
|
@ -185,14 +183,13 @@ onMounted(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Form ref="formRef" :model="modelData" label-width="0" class="mt-5">
|
||||
<Form :model="modelData" label-width="0" class="mt-5">
|
||||
<FormItem class="mb-5">
|
||||
<div class="w-full">
|
||||
<div
|
||||
class="w-full rounded-md border-2 border-dashed border-gray-200 p-5 text-center hover:border-blue-500"
|
||||
>
|
||||
<UploadDragger
|
||||
ref="uploadRef"
|
||||
class="upload-demo"
|
||||
:action="uploadUrl"
|
||||
v-model:file-list="fileList"
|
||||
|
|
|
|||
Loading…
Reference in New Issue