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
|
base.2=/home/duffy/Dokumente/programmierung/ARIA-AGENT/android/android/app/build/intermediates/dex/release/mergeDexRelease/classes2.dex
|
||||||
path.2=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
|
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, {
|
import DocumentPicker, {
|
||||||
DocumentPickerResponse,
|
DocumentPickerResponse,
|
||||||
} from 'react-native-document-picker';
|
} from 'react-native-document-picker';
|
||||||
|
import RNFS from 'react-native-fs';
|
||||||
|
|
||||||
// --- Typen ---
|
// --- Typen ---
|
||||||
|
|
||||||
|
|
@ -74,15 +75,17 @@ const FileUpload: React.FC<FileUploadProps> = ({ onFileSelected, onCancel }) =>
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
// In Produktion: Datei lesen und zu Base64 konvertieren
|
// Datei lesen und zu Base64 konvertieren
|
||||||
// const base64 = await RNFS.readFile(selectedFile.fileCopyUri || selectedFile.uri, 'base64');
|
const filePath = selectedFile.fileCopyUri || selectedFile.uri;
|
||||||
const base64Placeholder = '';
|
// URI-Schema entfernen fuer RNFS (file:// → absoluter Pfad)
|
||||||
|
const cleanPath = filePath.replace('file://', '');
|
||||||
|
const base64 = await RNFS.readFile(cleanPath, 'base64');
|
||||||
|
|
||||||
const fileData: FileData = {
|
const fileData: FileData = {
|
||||||
name: selectedFile.name || 'unbenannt',
|
name: selectedFile.name || 'unbenannt',
|
||||||
type: selectedFile.type || 'application/octet-stream',
|
type: selectedFile.type || 'application/octet-stream',
|
||||||
size: selectedFile.size || 0,
|
size: selectedFile.size || 0,
|
||||||
base64: base64Placeholder,
|
base64,
|
||||||
uri: selectedFile.uri,
|
uri: selectedFile.uri,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,10 @@ const ChatScreen: React.FC = () => {
|
||||||
console.error('[Chat] Fehler beim Laden des Verlaufs:', err);
|
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
|
// RVS-Nachrichten abonnieren
|
||||||
|
|
@ -159,7 +162,7 @@ const ChatScreen: React.FC = () => {
|
||||||
const userMsg: ChatMessage = {
|
const userMsg: ChatMessage = {
|
||||||
id: nextId(),
|
id: nextId(),
|
||||||
sender: 'user',
|
sender: 'user',
|
||||||
text: '[Sprachnachricht]',
|
text: '🎙 Spracheingabe wird verarbeitet...',
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
attachments: [{ type: 'audio', name: 'Sprachaufnahme' }],
|
attachments: [{ type: 'audio', name: 'Sprachaufnahme' }],
|
||||||
};
|
};
|
||||||
|
|
@ -262,9 +265,8 @@ const ChatScreen: React.FC = () => {
|
||||||
const userMsg: ChatMessage = {
|
const userMsg: ChatMessage = {
|
||||||
id: nextId(),
|
id: nextId(),
|
||||||
sender: 'user',
|
sender: 'user',
|
||||||
text: '[Sprachnachricht]',
|
text: '🎙 Spracheingabe wird verarbeitet...',
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
attachments: [{ type: 'audio', name: 'Sprachaufnahme' }],
|
|
||||||
};
|
};
|
||||||
setMessages(prev => [...prev, userMsg]);
|
setMessages(prev => [...prev, userMsg]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -954,10 +954,40 @@ class ARIABridge:
|
||||||
await self.ws_core.send(raw_message)
|
await self.ws_core.send(raw_message)
|
||||||
|
|
||||||
elif msg_type == "file":
|
elif msg_type == "file":
|
||||||
# Datei von der App → an aria-core
|
# Datei von der App → als Text-Nachricht an aria-core
|
||||||
logger.info("[rvs] Datei empfangen: %s", payload.get("name", "?"))
|
file_name = payload.get("name", "unbekannt")
|
||||||
if self.ws_core:
|
file_type = payload.get("type", "")
|
||||||
await self.ws_core.send(raw_message)
|
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":
|
elif msg_type == "audio":
|
||||||
# Audio von der App → decodieren → STT → an aria-core
|
# Audio von der App → decodieren → STT → an aria-core
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue