mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-28 03:38:11 +08:00
Feat: Display release status in agent version history. (#13479)
### What problem does this PR solve? Feat: Display release status in agent version history. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: balibabu <assassin_cike@163.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from '@/components/ui/dialog';
|
||||
import { IFlow } from '@/interfaces/database/agent';
|
||||
import { Operator } from '@/pages/agent/constant';
|
||||
import useGraphStore from '@/pages/agent/store';
|
||||
import { formatDate } from '@/utils/date';
|
||||
@@ -16,7 +17,7 @@ import { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
interface PublishConfirmDialogProps {
|
||||
agentDetail: { title: string; update_time?: number };
|
||||
agentDetail: IFlow;
|
||||
loading: boolean;
|
||||
onPublish: () => void;
|
||||
}
|
||||
@@ -42,8 +43,8 @@ export function PublishConfirmDialog({
|
||||
}, [nodes]);
|
||||
|
||||
const lastPublished = useMemo(() => {
|
||||
if (agentDetail?.update_time) {
|
||||
return formatDate(agentDetail.update_time);
|
||||
if (agentDetail?.last_publish_time) {
|
||||
return formatDate(agentDetail.last_publish_time);
|
||||
}
|
||||
return '-';
|
||||
}, [agentDetail?.update_time]);
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from '@/components/ui/dialog';
|
||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||
import { Spin } from '@/components/ui/spin';
|
||||
import { RAGFlowTooltip } from '@/components/ui/tooltip';
|
||||
import { useClientPagination } from '@/hooks/logic-hooks/use-pagination';
|
||||
import {
|
||||
useFetchVersion,
|
||||
@@ -25,6 +26,12 @@ import { ReactNode, useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { nodeTypes } from '../canvas';
|
||||
|
||||
function Dot() {
|
||||
return (
|
||||
<span className="w-2 h-2 inline-block rounded-full bg-accent-primary flex-shrink-0" />
|
||||
);
|
||||
}
|
||||
|
||||
export function VersionDialog({
|
||||
hideModal,
|
||||
}: IModalProps<any> & { initialName?: string; title?: ReactNode }) {
|
||||
@@ -58,7 +65,7 @@ export function VersionDialog({
|
||||
|
||||
return (
|
||||
<Dialog open onOpenChange={hideModal}>
|
||||
<DialogContent className="max-w-[60vw]">
|
||||
<DialogContent className="max-w-[900px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-base">
|
||||
{t('flow.historyVersion')}
|
||||
@@ -78,7 +85,10 @@ export function VersionDialog({
|
||||
})}
|
||||
onClick={handleClick(x.id)}
|
||||
>
|
||||
{x.title}
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="truncate">{x.title}</span>
|
||||
{x.release && <Dot></Dot>}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -92,11 +102,24 @@ export function VersionDialog({
|
||||
<CardContent className="h-full p-5 flex flex-col">
|
||||
<section className="flex justify-between">
|
||||
<div>
|
||||
<div className="pb-1 truncate">{agent?.title}</div>
|
||||
<div className="flex">
|
||||
<span className="pb-1 truncate">{agent?.title}</span>
|
||||
{agent?.release && (
|
||||
<RAGFlowTooltip tooltip={t('flow.productionTooltip')}>
|
||||
<Button className="bg-accent-primary-5 ml-3">
|
||||
<Dot></Dot>
|
||||
<span className="text-accent-primary pl-2 rounded">
|
||||
{t('flow.production')}
|
||||
</span>
|
||||
</Button>
|
||||
</RAGFlowTooltip>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-text-secondary text-xs">
|
||||
Created: {formatDate(agent?.create_date)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Button variant={'ghost'} onClick={downloadFile}>
|
||||
<ArrowDownToLine />
|
||||
</Button>
|
||||
|
||||
@@ -19,7 +19,12 @@ export function AgentCard({ data, showAgentRenameModal }: DatasetCardProps) {
|
||||
return (
|
||||
<HomeCard
|
||||
testId="agent-card"
|
||||
data={{ ...data, name: data.title, description: data.description || '' }}
|
||||
data={{
|
||||
...data,
|
||||
name: data.title,
|
||||
description: data.description || '',
|
||||
release_time: data.release_time,
|
||||
}}
|
||||
moreDropdown={
|
||||
<AgentDropdown showAgentRenameModal={showAgentRenameModal} agent={data}>
|
||||
<MoreButton></MoreButton>
|
||||
|
||||
Reference in New Issue
Block a user