added auto scroll, fixed stt for voice messages, fixed get answers in chat, hope fixed attachments
This commit is contained in:
parent
f1f297b3a7
commit
8fb95b884f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
|
@ -1,4 +1,4 @@
|
|||
#Sun Mar 29 11:40:22 CEST 2026
|
||||
#Sun Mar 29 11:54:43 CEST 2026
|
||||
base.2=/home/duffy/Dokumente/programmierung/ARIA-AGENT/android/android/app/build/intermediates/dex/release/mergeDexRelease/classes2.dex
|
||||
path.2=classes2.dex
|
||||
base.1=/home/duffy/Dokumente/programmierung/ARIA-AGENT/android/android/app/build/intermediates/global_synthetics_dex/release/classes.dex
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -17,6 +17,7 @@ import {
|
|||
import DocumentPicker, {
|
||||
DocumentPickerResponse,
|
||||
} from 'react-native-document-picker';
|
||||
import RNFS from 'react-native-fs';
|
||||
|
||||
// --- Typen ---
|
||||
|
||||
|
|
@ -74,15 +75,17 @@ const FileUpload: React.FC<FileUploadProps> = ({ onFileSelected, onCancel }) =>
|
|||
|
||||
setLoading(true);
|
||||
try {
|
||||
// In Produktion: Datei lesen und zu Base64 konvertieren
|
||||
// const base64 = await RNFS.readFile(selectedFile.fileCopyUri || selectedFile.uri, 'base64');
|
||||
const base64Placeholder = '';
|
||||
// Datei lesen und zu Base64 konvertieren
|
||||
const filePath = selectedFile.fileCopyUri || selectedFile.uri;
|
||||
// URI-Schema entfernen fuer RNFS (file:// → absoluter Pfad)
|
||||
const cleanPath = filePath.replace('file://', '');
|
||||
const base64 = await RNFS.readFile(cleanPath, 'base64');
|
||||
|
||||
const fileData: FileData = {
|
||||
name: selectedFile.name || 'unbenannt',
|
||||
type: selectedFile.type || 'application/octet-stream',
|
||||
size: selectedFile.size || 0,
|
||||
base64: base64Placeholder,
|
||||
base64,
|
||||
uri: selectedFile.uri,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,10 @@ const ChatScreen: React.FC = () => {
|
|||
console.error('[Chat] Fehler beim Laden des Verlaufs:', err);
|
||||
}
|
||||
};
|
||||
loadMessages();
|
||||
loadMessages().then(() => {
|
||||
// Auto-Scroll nach Laden des Verlaufs
|
||||
setTimeout(() => flatListRef.current?.scrollToEnd({ animated: false }), 200);
|
||||
});
|
||||
}, []);
|
||||
|
||||
// RVS-Nachrichten abonnieren
|
||||
|
|
@ -159,7 +162,7 @@ const ChatScreen: React.FC = () => {
|
|||
const userMsg: ChatMessage = {
|
||||
id: nextId(),
|
||||
sender: 'user',
|
||||
text: '[Sprachnachricht]',
|
||||
text: '🎙 Spracheingabe wird verarbeitet...',
|
||||
timestamp: Date.now(),
|
||||
attachments: [{ type: 'audio', name: 'Sprachaufnahme' }],
|
||||
};
|
||||
|
|
@ -262,9 +265,8 @@ const ChatScreen: React.FC = () => {
|
|||
const userMsg: ChatMessage = {
|
||||
id: nextId(),
|
||||
sender: 'user',
|
||||
text: '[Sprachnachricht]',
|
||||
text: '🎙 Spracheingabe wird verarbeitet...',
|
||||
timestamp: Date.now(),
|
||||
attachments: [{ type: 'audio', name: 'Sprachaufnahme' }],
|
||||
};
|
||||
setMessages(prev => [...prev, userMsg]);
|
||||
|
||||
|
|
|
|||
|
|
@ -954,10 +954,40 @@ class ARIABridge:
|
|||
await self.ws_core.send(raw_message)
|
||||
|
||||
elif msg_type == "file":
|
||||
# Datei von der App → an aria-core
|
||||
logger.info("[rvs] Datei empfangen: %s", payload.get("name", "?"))
|
||||
if self.ws_core:
|
||||
await self.ws_core.send(raw_message)
|
||||
# Datei von der App → als Text-Nachricht an aria-core
|
||||
file_name = payload.get("name", "unbekannt")
|
||||
file_type = payload.get("type", "")
|
||||
file_b64 = payload.get("base64", "")
|
||||
file_size = payload.get("size", 0)
|
||||
width = payload.get("width", 0)
|
||||
height = payload.get("height", 0)
|
||||
logger.info("[rvs] Datei empfangen: %s (%s, %dKB)",
|
||||
file_name, file_type, len(file_b64) // 1365 if file_b64 else 0)
|
||||
|
||||
if file_b64 and file_type.startswith("image/"):
|
||||
# Bild: als temporaere Datei speichern und Pfad an ARIA melden
|
||||
ext = ".jpg" if "jpeg" in file_type or "jpg" in file_type else ".png"
|
||||
tmp = tempfile.NamedTemporaryFile(suffix=ext, dir="/tmp", delete=False, prefix="aria_img_")
|
||||
tmp.write(base64.b64decode(file_b64))
|
||||
tmp.close()
|
||||
text = (f"[Bild von Stefan via App: {file_name}"
|
||||
f"{f', {width}x{height}px' if width else ''}"
|
||||
f" — gespeichert als {tmp.name}]"
|
||||
f" Bitte analysiere das Bild.")
|
||||
await self.send_to_core(text, source="app-file")
|
||||
elif file_b64:
|
||||
# Andere Datei: speichern und Pfad melden
|
||||
ext = Path(file_name).suffix or ".bin"
|
||||
tmp = tempfile.NamedTemporaryFile(suffix=ext, dir="/tmp", delete=False, prefix="aria_file_")
|
||||
tmp.write(base64.b64decode(file_b64))
|
||||
tmp.close()
|
||||
text = (f"[Datei von Stefan via App: {file_name}"
|
||||
f" ({file_type}, {file_size} bytes)"
|
||||
f" — gespeichert als {tmp.name}]")
|
||||
await self.send_to_core(text, source="app-file")
|
||||
else:
|
||||
text = f"[Stefan hat eine Datei gesendet: {file_name} ({file_type}) — aber keine Daten empfangen]"
|
||||
await self.send_to_core(text, source="app-file")
|
||||
|
||||
elif msg_type == "audio":
|
||||
# Audio von der App → decodieren → STT → an aria-core
|
||||
|
|
|
|||
Loading…
Reference in New Issue