fix: critical bugs -- ChatInput var, authService types, dep placement

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
senke 2026-02-12 21:53:39 +01:00
parent 37dae9e646
commit d919f8c7c9
4 changed files with 21 additions and 8 deletions

View file

@ -64,7 +64,6 @@
"@sentry/react": "^10.32.1",
"@tanstack/react-query": "^5.17.0",
"@tanstack/react-virtual": "^3.13.12",
"@types/dompurify": "^3.0.5",
"axios": "^1.13.5",
"clsx": "^2.1.0",
"date-fns": "^4.1.0",
@ -83,9 +82,6 @@
"react-hot-toast": "^2.6.0",
"react-i18next": "^15.7.3",
"react-router-dom": "^6.22.0",
"rollup-plugin-visualizer": "^6.0.5",
"swagger-ui-dist": "^5.31.0",
"swagger-ui-react": "^5.31.0",
"tailwind-merge": "^2.2.1",
"zod": "^3.25.76",
"zustand": "^4.5.0"
@ -108,8 +104,12 @@
"@types/react-dom": "^18.2.18",
"@types/react-dropzone": "^4.2.2",
"@types/swagger-ui-react": "^5.18.0",
"@types/dompurify": "^3.0.5",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"rollup-plugin-visualizer": "^6.0.5",
"swagger-ui-dist": "^5.31.0",
"swagger-ui-react": "^5.31.0",
"@typescript-eslint/parser": "^8.0.0",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/browser": "^3.2.4",

View file

@ -11,7 +11,6 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Alert, AlertDescription } from '@/components/ui/alert';
import { Loader2, Shield, AlertCircle } from 'lucide-react';
import { twoFactorService } from '@/services/2fa-service';
import { useToast } from '@/hooks/useToast';
import { parseApiError } from '@/utils/apiErrorHandler';

View file

@ -132,7 +132,7 @@ export const ChatInput: React.FC = () => {
{/* Attachments Preview */}
{attachments.length > 0 && (
<div className="absolute bottom-full left-0 right-0 p-4 bg-background/90 backdrop-blur-xl border-t border-white/10 flex gap-2 overflow-x-auto">
{attachments.map((att) => (
{attachments.map((att, idx) => (
<div
key={att.id || att.file_name}
className="relative group flex items-center gap-2 p-2 bg-white/5 rounded-lg border border-white/10 text-xs text-foreground min-w-36"
@ -144,7 +144,7 @@ export const ChatInput: React.FC = () => {
)}
<span className="truncate flex-1">{att.file_name}</span>
<button
onClick={() => removeAttachment(i)}
onClick={() => removeAttachment(idx)}
className="p-1 hover:bg-white/10 rounded-full text-destructive opacity-0 group-hover:opacity-100 transition-opacity"
>
<X size={12} />

View file

@ -2,6 +2,20 @@ import { apiClient } from '@/services/api/client';
import { User, UserDTO } from '../types';
import { logger } from '@/utils/logger';
export interface LoginCredentials {
email: string;
password: string;
remember_me?: boolean;
}
export interface RegisterData {
username: string;
email: string;
password: string;
first_name?: string;
last_name?: string;
}
// Helper to map Backend DTO to Frontend Model
const mapUserDTO = (dto: UserDTO): User => ({
id: dto.id,
@ -51,7 +65,7 @@ export const authService = {
};
},
register: async (data: any) => {
register: async (data: RegisterData) => {
const response = await apiClient.post<{
user: UserDTO;
access_token: string;