Add File
This commit is contained in:
319
main/ui/gd_mgr.html
Normal file
319
main/ui/gd_mgr.html
Normal file
@@ -0,0 +1,319 @@
|
||||
<div x-data="baike" class="w-full">
|
||||
<!-- 查询器 四角弧形的矩形容器 -->
|
||||
<div class="flex rounded-lg bg-white shadow-lg p-4 space-x-4">
|
||||
<!-- 横向排列的四个元素 -->
|
||||
<div class="relative flex w-full max-w-xs flex-col gap-1 text-neutral-600 dark:text-zinc-200">
|
||||
<input x-model="search" type="search" class="w-full rounded border border-zinc-300 bg-zinc-100 py-2 pl-10 pr-2 text-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-700 disabled:cursor-not-allowed disabled:opacity-75 dark:border-zinc-700 dark:bg-zinc-800/50 dark:focus-visible:outline-sky-600" name="search" placeholder="搜索智能体" aria-label="search"/>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true" class="absolute left-2.5 top-1/2 size-5 -translate-y-1/2 text-neutral-600/50 dark:text-zinc-200/50">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
|
||||
</svg>
|
||||
</div>
|
||||
<button @click="fetchSomething" type="button" class="cursor-pointer whitespace-nowrap rounded bg-sky-700 px-4 py-2 text-sm font-medium tracking-wide text-white transition hover:opacity-75 text-center focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-700 active:opacity-100 active:outline-offset-0 disabled:opacity-75 disabled:cursor-not-allowed dark:bg-sky-600 dark:text-white dark:focus-visible:outline-sky-600">查询</button>
|
||||
<button @click="open_aieditor(0)" type="button" class="cursor-pointer inline-flex justify-center items-center gap-2 whitespace-nowrap rounded bg-blue-700 px-4 py-2 text-sm font-medium tracking-wide text-white transition hover:opacity-75 text-center focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-700 active:opacity-100 active:outline-offset-0 disabled:opacity-75 disabled:cursor-not-allowed dark:bg-sky-600 dark:text-white dark:focus-visible:outline-sky-600">
|
||||
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="size-5 fill-white dark:fill-white" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M12 3.75a.75.75 0 01.75.75v6.75h6.75a.75.75 0 010 1.5h-6.75v6.75a.75.75 0 01-1.5 0v-6.75H4.5a.75.75 0 010-1.5h6.75V4.5a.75.75 0 01.75-.75z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
新建
|
||||
</button>
|
||||
<button @click="exp_agents" type="button" class="cursor-pointer inline-flex justify-center items-center gap-2 whitespace-nowrap rounded bg-sky-700 px-4 py-2 text-sm font-medium tracking-wide text-white transition hover:opacity-75 text-center focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-700 active:opacity-100 active:outline-offset-0 disabled:opacity-75 disabled:cursor-not-allowed dark:bg-sky-600 dark:text-white dark:focus-visible:outline-sky-600">
|
||||
导出
|
||||
</button>
|
||||
<input x-ref="fileInput" @input="imp_agents" type="file" multiple hidden class="w-full overflow-clip rounded border border-red-700 bg-zinc-100/50 text-sm text-red-700 file:mr-4 file:cursor-pointer file:border-none file:bg-zinc-100 file:px-4 file:py-2 file:font-medium file:text-neutral-900 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-700 disabled:cursor-not-allowed disabled:opacity-75 dark:bg-zinc-800/50 dark:file:bg-zinc-800 dark:file:text-zinc-50 dark:focus-visible:outline-sky-600" />
|
||||
<button @click="$refs.fileInput.click()" type="button" class="cursor-pointer inline-flex justify-center items-center gap-2 whitespace-nowrap rounded bg-green-700 px-4 py-2 text-sm font-medium tracking-wide text-white transition hover:opacity-75 text-center focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-700 active:opacity-100 active:outline-offset-0 disabled:opacity-75 disabled:cursor-not-allowed dark:bg-sky-600 dark:text-white dark:focus-visible:outline-sky-600">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" fill="currentColor" class="size-6 opacity-75">
|
||||
<path fill-rule="evenodd" d="M10.5 3.75a6 6 0 0 0-5.98 6.496A5.25 5.25 0 0 0 6.75 20.25H18a4.5 4.5 0 0 0 2.206-8.423 3.75 3.75 0 0 0-4.133-4.303A6.001 6.001 0 0 0 10.5 3.75Zm2.03 5.47a.75.75 0 0 0-1.06 0l-3 3a.75.75 0 1 0 1.06 1.06l1.72-1.72v4.94a.75.75 0 0 0 1.5 0v-4.94l1.72 1.72a.75.75 0 1 0 1.06-1.06l-3-3Z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
导入
|
||||
</button>
|
||||
<button type="button" @click="gdSelectedTab = 'my'" class="text-white bg-gradient-to-br from-indigo-600 to-blue-600 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-600 rounded-full inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap px-4 py-1 text-xs tracking-wide transition hover:opacity-75 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 active:opacity-100 active:outline-offset-0 disabled:cursor-not-allowed disabled:opacity-75">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="size-5">
|
||||
<path d="m9.653 16.915-.005-.003-.019-.01a20.759 20.759 0 0 1-1.162-.682 22.045 22.045 0 0 1-2.582-1.9C4.045 12.733 2 10.352 2 7.5a4.5 4.5 0 0 1 8-2.828A4.5 4.5 0 0 1 18 7.5c0 2.852-2.044 5.233-3.885 6.82a22.049 22.049 0 0 1-3.744 2.582l-.019.01-.005.003h-.002a.739.739 0 0 1-.69.001l-.002-.001Z" />
|
||||
</svg>
|
||||
回到我的智能体
|
||||
</button>
|
||||
</div>
|
||||
<!-- 结果表格-->
|
||||
<div class="mt-4 overflow-hidden w-full overflow-x-auto rounded border border-zinc-300 dark:border-zinc-700">
|
||||
<table class="w-full text-left text-sm text-neutral-600 dark:text-zinc-200">
|
||||
<thead class="border-b border-zinc-300 bg-zinc-100 text-sm text-neutral-900 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-50">
|
||||
<tr>
|
||||
<th scope="col" class="p-4">
|
||||
<label for="checkAll" class="flex items-center cursor-pointer text-neutral-600 dark:text-zinc-200 ">
|
||||
<div class="relative flex items-center">
|
||||
<input type="checkbox" x-model="checkAll" id="checkAll" class="before:content[''] peer relative size-4 cursor-pointer appearance-none overflow-hidden rounded border border-zinc-300 bg-zinc-50 before:absolute before:inset-0 checked:border-sky-700 checked:before:bg-sky-700 focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-zinc-500 checked:focus:outline-sky-700 active:outline-offset-0 dark:border-zinc-700 dark:bg-zinc-800 dark:checked:border-sky-600 dark:checked:before:bg-sky-600 dark:focus:outline-zinc-500 dark:checked:focus:outline-sky-600" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" stroke="currentColor" fill="none" stroke-width="4" class="pointer-events-none invisible absolute left-1/2 top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 text-white peer-checked:visible dark:text-white">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/>
|
||||
</svg>
|
||||
</div>
|
||||
</label>
|
||||
</th>
|
||||
<th scope="col" class="p-4">名称</th>
|
||||
<th scope="col" class="p-4">简介</th>
|
||||
<th scope="col" class="p-4">类型</th>
|
||||
<th scope="col" class="p-4">标签</th>
|
||||
<th scope="col" class="p-4">作者</th>
|
||||
<th scope="col" class="p-4">日期</th>
|
||||
<th scope="col" class="p-4">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-zinc-300 dark:divide-zinc-700">
|
||||
<template x-for="(item,index) in Items" :key="item.id">
|
||||
<tr>
|
||||
<td class="p-2 px-4">
|
||||
<label for="user2338" class="flex items-center cursor-pointer text-neutral-600 dark:text-zinc-200 ">
|
||||
<div class="relative flex items-center">
|
||||
<input type="checkbox" x-model="selected" :value="item.id" class="before:content[''] peer relative size-4 cursor-pointer appearance-none overflow-hidden rounded border border-zinc-300 bg-zinc-50 before:absolute before:inset-0 checked:border-sky-700 checked:before:bg-sky-700 focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-zinc-500 checked:focus:outline-sky-700 active:outline-offset-0 dark:border-zinc-700 dark:bg-zinc-800 dark:checked:border-sky-600 dark:checked:before:bg-sky-600 dark:focus:outline-zinc-500 dark:checked:focus:outline-sky-600" :checked="checkAll" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" stroke="currentColor" fill="none" stroke-width="4" class="pointer-events-none invisible absolute left-1/2 top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 text-white peer-checked:visible dark:text-white">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/>
|
||||
</svg>
|
||||
</div>
|
||||
</label>
|
||||
</td>
|
||||
<td class="p-2 max-w-xs" ><a :href="kagent_url+item.kasn" x-text="item.title" target="_blank" :style="{ 'color': item.oth }" class="cursor-pointer hover:underline transition duration-300 ease-in-out"></a></td>
|
||||
<td class="p-2 max-w-s2" x-text="item.demo">词条</td>
|
||||
<td class="p-2 max-w-xs" x-text='({0:"文件检索", 1: "目录检索", 2: "AI生成",3:"融合智能",100:"未来扩展" })[item.atype] || "❓"'>类型</td>
|
||||
<td class="p-2 max-w-xs" :style="{ 'color': item.oth }" x-text='item.catalog'>标签</td>
|
||||
<td class="p-2">
|
||||
<div class="relative">
|
||||
<button x-text="item.modifier" type="button" class="peer cursor-pointer rounded bg-zinc-100 px-4 py-2 font-medium tracking-wide text-neutral-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-700 dark:bg-zinc-800 dark:text-zinc-200 dark:focus-visible:outline-sky-600" aria-describedby="tooltipExample">Hover Me</button>
|
||||
<div x-html="`创建者:${item.creator}<br>更新者:${item.modifier}`" id="tooltipExample" class="absolute -top-9 left-1/2 -translate-x-1/2 z-10 whitespace-nowrap rounded bg-zinc-900 px-2 py-1 text-center text-sm text-zinc-50 opacity-0 transition-all ease-out peer-hover:opacity-100 peer-focus:opacity-100 dark:bg-zinc-50 dark:text-neutral-900" role="tooltip">Tooltip top</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="p-2">
|
||||
<div class="relative">
|
||||
<button x-text="item.m_time.slice(0,10)" type="button" class="peer cursor-pointer rounded bg-zinc-50 px-4 py-2 font-medium tracking-wide text-neutral-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-700 dark:bg-zinc-800 dark:text-zinc-200 dark:focus-visible:outline-sky-600" aria-describedby="tooltipExample">Hover Me</button>
|
||||
<div x-text="item.m_time.slice(0,19)" id="tooltipExample" class="absolute -top-9 left-1/2 -translate-x-1/2 z-10 whitespace-nowrap rounded bg-zinc-900 px-2 py-1 text-center text-sm text-zinc-50 opacity-0 transition-all ease-out peer-hover:opacity-100 peer-focus:opacity-100 dark:bg-zinc-50 dark:text-neutral-900" role="tooltip">Tooltip top</div>
|
||||
</div></td>
|
||||
|
||||
<td class="p-2">
|
||||
<!--<button type="button" @click="window.open('view.html?id='+item.id)" class="cursor-pointer whitespace-nowrap rounded bg-transparent p-0.5 font-semibold text-sky-700 outline-sky-700 hover:opacity-75 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 active:opacity-100 active:outline-offset-0 dark:text-sky-600 dark:outline-sky-600">查看</button>-->
|
||||
<button @click="open_aieditor(item.id,item.kasn)" type="button" class="cursor-pointer whitespace-nowrap rounded bg-transparent p-0.5 font-semibold text-sky-700 outline-sky-700 hover:opacity-75 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 active:opacity-100 active:outline-offset-0 dark:text-sky-600 dark:outline-sky-600">编辑</button>
|
||||
<button x-show="$store.nav.is_admin | $store.nav.username==item.creator" @click="del_kagent(index)" type="button" class="cursor-pointer whitespace-nowrap rounded bg-transparent p-0.5 font-semibold text-sky-700 outline-sky-700 hover:opacity-75 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 active:opacity-100 active:outline-offset-0 dark:text-sky-600 dark:outline-sky-600">删除</button>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<!-- 翻页-->
|
||||
<nav aria-label="pagination">
|
||||
<ul class="flex flex-shrink-0 items-center gap-2 text-sm font-medium">
|
||||
<li> 共<span x-text="count" class="font-bold">200</span>条/显示前<span x-text="view_count" class="font-bold"></span>条</li>
|
||||
<li>
|
||||
<a href="#" @click="curPage===1 ? pageSlie(1): pageSlie(curPage-1) " class="flex items-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="previous page">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="size-6">
|
||||
<path fill-rule="evenodd" d="M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
上一页
|
||||
</a>
|
||||
</li>
|
||||
<li x-show="count/pageSize+1 >=1"><a href="#" @click="pageSlie(1)" :class="curPage===1 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="page 1">1</a></li>
|
||||
<li x-show="count/pageSize+1 >=2"><a href="#" @click="pageSlie(2)" :class="curPage===2 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:bg-sky-600 dark:text-white" aria-label="page 2">2</a></li>
|
||||
<li x-show="count/pageSize+1 >=3"><a href="#" @click="pageSlie(3)" :class="curPage===3 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="page 3">3</a></li>
|
||||
<li x-show="count/pageSize+1 >=4"><a href="#" @click="pageSlie(4)" :class="curPage===4 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="page 4">4</a></li>
|
||||
<li x-show="count/pageSize+1 >=5"><a href="#" @click="pageSlie(5)" :class="curPage===5 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="page 5">5</a></li>
|
||||
<li x-show="count/pageSize+1 >=6"><a href="#" @click="pageSlie(6)" :class="curPage===6 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="page 1">6</a></li>
|
||||
<li x-show="count/pageSize+1 >=7"><a href="#" @click="pageSlie(7)" :class="curPage===7 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:bg-sky-600 dark:text-white" aria-label="page 2">7</a></li>
|
||||
<li x-show="count/pageSize+1 >=8"><a href="#" @click="pageSlie(8)" :class="curPage===8 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="page 3">8</a></li>
|
||||
<li x-show="count/pageSize+1 >=9"><a href="#" @click="pageSlie(9)" :class="curPage===9 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="page 4">9</a></li>
|
||||
<li x-show="count/pageSize+1 >=10"><a href="#" @click="pageSlie(10)" :class="curPage===10 ? 'bg-sky-700 text-white font-bold ' :''" class="flex size-6 items-center justify-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="page 5">10</a></li>
|
||||
|
||||
<li>
|
||||
<a href="#" @click="curPage=== parseInt(count/pageSize)+1 ? pageSlie(parseInt(count/pageSize)+1): pageSlie(curPage+1) " class="flex items-center rounded p-1 text-neutral-600 hover:text-sky-700 dark:text-zinc-200 dark:hover:text-sky-600" aria-label="next page">
|
||||
下一页
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="size-6">
|
||||
<path fill-rule="evenodd" d="M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<!-- AI 编辑器 Info Modal -->
|
||||
|
||||
<template x-if="AIEditorOpen">
|
||||
<div x-cloak x-transition.opacity.duration.200ms x-trap.inert.noscroll="AIEditorOpen" @keydown.esc.window="close_aieditor" class="fixed inset-0 z-30 flex items-end justify-center bg-black/20 p-4 backdrop-blur-md sm:items-center lg:p-4" role="dialog" aria-modal="true" aria-labelledby="infoModalTitle">
|
||||
<!-- Modal Dialog -->
|
||||
<div x-show="AIEditorOpen" x-transition:enter="transition ease-out duration-200 delay-100 motion-reduce:transition-opacity" x-transition:enter-start="opacity-0 scale-50" x-transition:enter-end="opacity-100 scale-100" class="flex w-full h-full flex-col gap-1 overflow-hidden rounded border border-zinc-300 bg-zinc-50 text-neutral-600 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-200">
|
||||
<!-- Dialog Header -->
|
||||
<div class="flex items-center justify-between border-b border-zinc-300 bg-zinc-100/60 px-4 py-2 dark:border-zinc-700 dark:bg-zinc-900/20">
|
||||
<div class="flex items-center justify-center rounded-full bg-sky-700/20 text-sky-700 p-1">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-6" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
智能体构建
|
||||
</div>
|
||||
<button @click="close_aieditor" aria-label="close modal">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" stroke="currentColor" fill="none" stroke-width="1.4" class="w-5 h-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<!-- Dialog Body -->
|
||||
<div class="px-4 py-2 overflow-y-auto">
|
||||
<div id="agent_edit" alp-unit="agent.html"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<!-- 删除确认 -->
|
||||
<template x-if="dangerModalIsOpen">
|
||||
<div x-cloak x-show="dangerModalIsOpen" x-transition.opacity.duration.200ms x-trap.inert.noscroll="dangerModalIsOpen" x-on:keydown.esc.window="dangerModalIsOpen = false" x-on:click.self="dangerModalIsOpen = false" class="fixed inset-0 z-30 flex items-end justify-center bg-black/20 p-4 pb-8 backdrop-blur-md sm:items-center lg:p-8" role="dialog" aria-modal="true" aria-labelledby="dangerModalTitle">
|
||||
<!-- Modal Dialog -->
|
||||
<div x-show="dangerModalIsOpen" x-transition:enter="transition ease-out duration-200 delay-100 motion-reduce:transition-opacity" x-transition:enter-start="opacity-0 scale-50" x-transition:enter-end="opacity-100 scale-100" class="flex max-w-lg flex-col gap-4 overflow-hidden rounded border border-zinc-300 bg-zinc-50 text-neutral-600 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-200">
|
||||
<!-- Dialog Header -->
|
||||
<div class="flex items-center justify-between border-b border-zinc-300 bg-zinc-100/60 px-4 py-2 dark:border-zinc-700 dark:bg-zinc-900/20">
|
||||
<div class="flex items-center justify-center rounded-full bg-red-700/20 text-red-700 p-1">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-6" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94 8.28 7.22Z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
<h3 id="dangerModalTitle" class="mx-4 font-semibold tracking-wide text-neutral-900 dark:text-zinc-50">删除确认:删除后将无法恢复! </h3>
|
||||
<button x-on:click="dangerModalIsOpen = false" aria-label="close modal">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" stroke="currentColor" fill="none" stroke-width="1.4" class="w-5 h-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<!-- Dialog Body -->
|
||||
<div class="px-4 text-left">
|
||||
<p><span class="font-bold">名称</span>:<span x-text="ready_del.title"></span></p>
|
||||
<p><span class="font-bold">介绍</span>:<span x-text="ready_del.demo"></span></p>
|
||||
<p><span class="font-bold">创建者</span>:<span x-text="ready_del.creator"></span></p>
|
||||
<p><span class="font-bold">更新者</span>:<span x-text="ready_del.modifier"></span></p>
|
||||
<p><span class="font-bold">更新时间</span>:<span x-text="ready_del.m_time"></span></p>
|
||||
</div>
|
||||
<!-- Dialog Footer -->
|
||||
<div class="flex items-center justify-center border-zinc-300 p-4 dark:border-zinc-700">
|
||||
<button x-on:click="do_del_kagent(ready_del.id)" type="button" class="w-full whitespace-nowrap rounded border border-red-700 bg-red-700 px-4 py-2 text-center text-sm font-semibold tracking-wide text-slate-100 transition hover:opacity-75 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-700 active:opacity-100 active:outline-offset-0">确认删除</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function baike(){
|
||||
return {
|
||||
checkAll: false,
|
||||
AIEditorOpen: false,
|
||||
dangerModalIsOpen: false, //删除窗口
|
||||
ready_del:{}, //将要删除的信息
|
||||
kagent_url: window.location.protocol+"//"+url.hostname+":7000?sn=",
|
||||
selected:[], //选中的知识体id
|
||||
search: '',
|
||||
aieditor_id:"create.html?id=0",
|
||||
catalog: '',
|
||||
catalogs: [],
|
||||
count: 0,
|
||||
view_count:0,
|
||||
pageSize:10,
|
||||
curPage: 1,
|
||||
aItems:[],
|
||||
Items:[],
|
||||
Agent_Kasn:"", //当前的agent 的kasn
|
||||
kagent_id:0,// 当前编辑或选中的agent id
|
||||
|
||||
init(){
|
||||
this.fetchSomething();
|
||||
},
|
||||
|
||||
open_aieditor(doc_id,sn){
|
||||
this.kagent_id = doc_id;
|
||||
this.AIEditorOpen=true;
|
||||
this.Agent_Kasn = sn;
|
||||
//dom 更新后加载==动态加载
|
||||
this.$nextTick(() => {
|
||||
var dom = document.getElementById("agent_edit")
|
||||
scan_alp_units(dom);
|
||||
});
|
||||
},
|
||||
close_aieditor(){
|
||||
this.AIEditorOpen=false;
|
||||
kagent_id = 0;
|
||||
this.fetchSomething();
|
||||
},
|
||||
fetchSomething() {
|
||||
axios.get('/api/kagent/mgr?q='+this.search).then(response => {
|
||||
//console.log('Data:', response.data);
|
||||
this.aItems = response.data.data;
|
||||
this.view_count = this.aItems.length;
|
||||
this.Items = this.aItems.slice(0,this.pageSize);
|
||||
this.curPage = 1;
|
||||
this.count=response.data.count;
|
||||
}).catch(error => {
|
||||
console.error('Error fetching data:', error);
|
||||
throw error; // 重新抛出错误以便调用者可以处理
|
||||
});
|
||||
},
|
||||
pageSlie(page){
|
||||
this.curPage = page;
|
||||
this.Items = this.aItems.slice(this.pageSize*(this.curPage-1),this.pageSize*this.curPage);
|
||||
},
|
||||
del_kagent(index){
|
||||
this.ready_del = this.Items[index];
|
||||
this.dangerModalIsOpen = true;
|
||||
},
|
||||
do_del_kagent(baike_id){
|
||||
this.dangerModalIsOpen = false;
|
||||
axios.delete('/api/kagent/'+baike_id).then(response => {
|
||||
|
||||
this.fetchSomething();
|
||||
}).catch(error => {
|
||||
console.error('Error fetching data:', error);
|
||||
throw error; // 重新抛出错误以便调用者可以处理
|
||||
});
|
||||
|
||||
},
|
||||
exp_agents(){
|
||||
// 使用 axios 发送 POST 请求
|
||||
axios.post('/api/kagent/export', this.selected)
|
||||
.then(response =>{
|
||||
window.open(`/api/fsd/${response.data.filename}`);
|
||||
})
|
||||
.catch(error => {
|
||||
alert(error);
|
||||
console.error('Error post data:', error);
|
||||
throw error; // 重新抛出错误以便调用者可以处理
|
||||
});
|
||||
},
|
||||
imp_agents(){
|
||||
const file = this.$refs.fileInput.files[0];
|
||||
if (!file) return;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
try {
|
||||
axios.post('/api/kagent/import', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}).then( response =>{
|
||||
|
||||
var result = response.data;
|
||||
|
||||
if (result.errno === 1) {
|
||||
|
||||
alert(result.message);
|
||||
return;
|
||||
}
|
||||
this.fetchSomething();
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
alert('An error occurred while uploading the file.');
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user