chore: update plan automation and chat status UI
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
ThunderboltOutlined,
|
||||
UpOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { Alert, Button, Input, Select, Spin, message } from 'antd';
|
||||
import { Alert, Button, Checkbox, Input, Select, Spin, message } from 'antd';
|
||||
import type { TextAreaRef } from 'antd/es/input/TextArea';
|
||||
import {
|
||||
useEffect,
|
||||
@@ -159,6 +159,16 @@ function buildInlinePreviewLabel(url: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function buildPreviewFileName(item: PreviewOption) {
|
||||
try {
|
||||
const parsed = new URL(item.url, typeof window !== 'undefined' ? window.location.origin : 'https://local.invalid');
|
||||
const fileName = parsed.pathname.split('/').filter(Boolean).at(-1)?.trim();
|
||||
return fileName || item.label.trim() || item.url;
|
||||
} catch {
|
||||
return item.label.trim() || item.url;
|
||||
}
|
||||
}
|
||||
|
||||
async function createPreviewFetchError(response: Response): Promise<PreviewFetchError> {
|
||||
const contentType = response.headers.get('content-type')?.toLowerCase() ?? '';
|
||||
let responseMessage = '';
|
||||
@@ -750,6 +760,7 @@ export function ChatConversationView({
|
||||
const [collapsedActivityRequestIds, setCollapsedActivityRequestIds] = useState<string[]>([]);
|
||||
const [collapsibleMessageIds, setCollapsibleMessageIds] = useState<number[]>([]);
|
||||
const [showBusyOverlay, setShowBusyOverlay] = useState(false);
|
||||
const [showLatestResourceOnly, setShowLatestResourceOnly] = useState(true);
|
||||
const fileInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const activitySectionRefs = useRef(new Map<string, HTMLElement>());
|
||||
const messageBodyRefs = useRef(new Map<number, HTMLDivElement>());
|
||||
@@ -808,6 +819,23 @@ export function ChatConversationView({
|
||||
return [...ordered, ...orphanActivityMessages];
|
||||
}, [visibleMessages]);
|
||||
const previewItemsByUrl = useMemo(() => new Map(previewItems.map((item) => [item.url, item])), [previewItems]);
|
||||
const visiblePreviewItems = useMemo(() => {
|
||||
if (!showLatestResourceOnly) {
|
||||
return previewItems;
|
||||
}
|
||||
|
||||
const seenFileNames = new Set<string>();
|
||||
return previewItems.filter((item) => {
|
||||
const fileName = buildPreviewFileName(item);
|
||||
|
||||
if (seenFileNames.has(fileName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
seenFileNames.add(fileName);
|
||||
return true;
|
||||
});
|
||||
}, [previewItems, showLatestResourceOnly]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof document === 'undefined') {
|
||||
@@ -1150,8 +1178,19 @@ export function ChatConversationView({
|
||||
{isResourceStripOpen ? (
|
||||
<div className="app-chat-panel__resource-strip">
|
||||
{previewItems.length > 0 ? (
|
||||
<div className="app-chat-panel__resource-strip-list">
|
||||
{previewItems.map((item) => (
|
||||
<>
|
||||
<label className="app-chat-panel__resource-strip-filter">
|
||||
<Checkbox
|
||||
checked={showLatestResourceOnly}
|
||||
onChange={(event) => {
|
||||
setShowLatestResourceOnly(event.target.checked);
|
||||
}}
|
||||
>
|
||||
같은 파일명은 최종 리소스만 보기
|
||||
</Checkbox>
|
||||
</label>
|
||||
<div className="app-chat-panel__resource-strip-list">
|
||||
{visiblePreviewItems.map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
type="button"
|
||||
@@ -1163,8 +1202,9 @@ export function ChatConversationView({
|
||||
<span>{item.label}</span>
|
||||
<span>{item.kind}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<span className="app-chat-panel__resource-strip-empty">
|
||||
현재 대화에 바로 열 수 있는 리소스가 없습니다.
|
||||
|
||||
Reference in New Issue
Block a user