Agent chat file drag and drop (#13226)

- Added drag and drop support
- The AIChatTab component has been refactored into smaller, more focused
components to improve readability, maintainability, and scalability of
the codebase.
- Introduced a custom useAIChatFileUpload hook to encapsulate and manage
file upload logic, promoting code reuse and separation of concerns.

### Demo

https://github.com/user-attachments/assets/c4b2a67a-2736-48ae-9ba8-8e124e4b6069

---------

Co-authored-by: Raphaël Bosi <71827178+bosiraphael@users.noreply.github.com>
Co-authored-by: neo773 <62795688+neo773@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@twenty.com>
Co-authored-by: MD Readul Islam <99027968+readul-islam@users.noreply.github.com>
Co-authored-by: readul-islam <developer.readul@gamil.com>
Co-authored-by: Thomas des Francs <tdesfrancs@gmail.com>
Co-authored-by: Guillim <guillim@users.noreply.github.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
Co-authored-by: Jean-Baptiste Ronssin <65334819+jbronssin@users.noreply.github.com>
Co-authored-by: kahkashan shaik <93042682+kahkashanshaik@users.noreply.github.com>
Co-authored-by: martmull <martmull@hotmail.fr>
Co-authored-by: Paul Rastoin <45004772+prastoin@users.noreply.github.com>
Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
Co-authored-by: Naifer <161821705+omarNaifer12@users.noreply.github.com>
Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
This commit is contained in:
Abdul Rahman
2025-07-16 17:09:54 +05:30
committed by GitHub
parent 47386e92a3
commit 0c73c9df50
6 changed files with 464 additions and 369 deletions
@@ -0,0 +1,39 @@
import { AgentChatThread } from '~/generated-metadata/graphql';
import { groupThreadsByDate } from '../groupThreadsByDate';
describe('groupThreadsByDate', () => {
const baseThread: Omit<AgentChatThread, 'createdAt' | 'id'> = {
agentId: 'agent-1',
title: 'Test Thread',
updatedAt: new Date().toISOString(),
};
const today = new Date();
const yesterday = new Date(today);
yesterday.setDate(today.getDate() - 1);
const twoDaysAgo = new Date(today);
twoDaysAgo.setDate(today.getDate() - 2);
const threads: AgentChatThread[] = [
{ ...baseThread, id: '1', createdAt: today.toISOString() },
{ ...baseThread, id: '2', createdAt: yesterday.toISOString() },
{ ...baseThread, id: '3', createdAt: twoDaysAgo.toISOString() },
];
it('groups threads into today, yesterday, and older', () => {
const result = groupThreadsByDate(threads);
expect(result.today).toHaveLength(1);
expect(result.today[0].id).toBe('1');
expect(result.yesterday).toHaveLength(1);
expect(result.yesterday[0].id).toBe('2');
expect(result.older).toHaveLength(1);
expect(result.older[0].id).toBe('3');
});
it('returns empty arrays if no threads', () => {
const result = groupThreadsByDate([]);
expect(result.today).toEqual([]);
expect(result.yesterday).toEqual([]);
expect(result.older).toEqual([]);
});
});