feat(T07): KI-Copilot with OpenRouter chat, voice input, action system, chat history

This commit is contained in:
2026-07-17 02:28:41 +02:00
parent cb89e3ff1e
commit 5cc9f8e9a9
24 changed files with 2878 additions and 188 deletions
+51
View File
@@ -0,0 +1,51 @@
'use client';
import { useState, useCallback, type KeyboardEvent } from 'react';
interface ChatInputProps {
onSend: (text: string) => void;
disabled?: boolean;
}
export function ChatInput({ onSend, disabled }: ChatInputProps) {
const [text, setText] = useState('');
const handleSend = useCallback(() => {
if (!text.trim() || disabled) return;
onSend(text.trim());
setText('');
}, [text, disabled, onSend]);
const handleKeyDown = useCallback(
(e: KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
handleSend();
}
},
[handleSend]
);
return (
<div className="flex-1 flex gap-2" data-testid="chat-input-container">
<textarea
value={text}
onChange={(e) => setText(e.target.value)}
onKeyDown={handleKeyDown}
disabled={disabled}
placeholder="Nachricht an Copilot..."
className="flex-1 border border-gray-300 rounded-lg px-3 py-2 resize-none focus:outline-none focus:ring-2 focus:ring-blue-500"
rows={1}
data-testid="chat-input"
/>
<button
onClick={handleSend}
disabled={disabled || !text.trim()}
className="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"
data-testid="send-button"
>
Senden
</button>
</div>
);
}