tts fix big pictures

This commit is contained in:
2026-03-29 17:02:02 +02:00
parent 8a6bd4e0e7
commit 8281131432
3 changed files with 40 additions and 3 deletions
+33 -3
View File
@@ -90,6 +90,7 @@ const ChatScreen: React.FC = () => {
const [showCameraUpload, setShowCameraUpload] = useState(false); const [showCameraUpload, setShowCameraUpload] = useState(false);
const [gpsEnabled, setGpsEnabled] = useState(false); const [gpsEnabled, setGpsEnabled] = useState(false);
const [wakeWordActive, setWakeWordActive] = useState(false); const [wakeWordActive, setWakeWordActive] = useState(false);
const [fullscreenImage, setFullscreenImage] = useState<string | null>(null);
const flatListRef = useRef<FlatList>(null); const flatListRef = useRef<FlatList>(null);
const messageIdCounter = useRef(0); const messageIdCounter = useRef(0);
@@ -525,12 +526,12 @@ const ChatScreen: React.FC = () => {
{item.attachments?.map((att, idx) => ( {item.attachments?.map((att, idx) => (
<View key={idx}> <View key={idx}>
{att.type === 'image' && att.uri ? ( {att.type === 'image' && att.uri ? (
<TouchableOpacity onPress={() => setFullscreenImage(att.uri || null)} activeOpacity={0.8}>
<Image <Image
source={{ uri: att.uri }} source={{ uri: att.uri }}
style={styles.attachmentImage} style={styles.attachmentImage}
resizeMode="contain" resizeMode="cover"
onError={() => { onError={() => {
// Bild nicht mehr verfuegbar — Placeholder setzen
setMessages(prev => prev.map(m => setMessages(prev => prev.map(m =>
m.id === item.id ? { ...m, attachments: m.attachments?.map((a, i) => m.id === item.id ? { ...m, attachments: m.attachments?.map((a, i) =>
i === idx ? { ...a, uri: undefined } : a i === idx ? { ...a, uri: undefined } : a
@@ -538,6 +539,7 @@ const ChatScreen: React.FC = () => {
)); ));
}} }}
/> />
</TouchableOpacity>
) : att.type === 'image' && !att.uri ? ( ) : att.type === 'image' && !att.uri ? (
<TouchableOpacity <TouchableOpacity
style={styles.attachmentFile} style={styles.attachmentFile}
@@ -675,6 +677,23 @@ const ChatScreen: React.FC = () => {
)} )}
</View> </View>
{/* Bild-Vollbild Modal */}
<Modal visible={!!fullscreenImage} transparent animationType="fade" onRequestClose={() => setFullscreenImage(null)}>
<TouchableOpacity
style={styles.fullscreenOverlay}
activeOpacity={1}
onPress={() => setFullscreenImage(null)}
>
{fullscreenImage && (
<Image
source={{ uri: fullscreenImage }}
style={styles.fullscreenImage}
resizeMode="contain"
/>
)}
</TouchableOpacity>
</Modal>
{/* Datei-Upload Modal */} {/* Datei-Upload Modal */}
<Modal visible={showFileUpload} transparent animationType="slide"> <Modal visible={showFileUpload} transparent animationType="slide">
<View style={styles.modalOverlay}> <View style={styles.modalOverlay}>
@@ -757,7 +776,8 @@ const styles = StyleSheet.create({
}, },
attachmentImage: { attachmentImage: {
width: '100%', width: '100%',
height: 200, minHeight: 200,
maxHeight: 400,
borderRadius: 8, borderRadius: 8,
marginBottom: 6, marginBottom: 6,
backgroundColor: '#0D0D1A', backgroundColor: '#0D0D1A',
@@ -867,6 +887,16 @@ const styles = StyleSheet.create({
wakeWordIcon: { wakeWordIcon: {
fontSize: 16, fontSize: 16,
}, },
fullscreenOverlay: {
flex: 1,
backgroundColor: 'rgba(0,0,0,0.95)',
justifyContent: 'center',
alignItems: 'center',
},
fullscreenImage: {
width: '100%',
height: '100%',
},
modalOverlay: { modalOverlay: {
flex: 1, flex: 1,
backgroundColor: 'rgba(0,0,0,0.6)', backgroundColor: 'rgba(0,0,0,0.6)',
+3
View File
@@ -184,6 +184,9 @@ class VoiceEngine:
tmp_path = tmp.name tmp_path = tmp.name
with wave.open(tmp_path, "wb") as wav_file: with wave.open(tmp_path, "wb") as wav_file:
wav_file.setnchannels(1)
wav_file.setsampwidth(2) # 16-bit
wav_file.setframerate(voice.config.sample_rate)
voice.synthesize(text, wav_file) voice.synthesize(text, wav_file)
audio_data = Path(tmp_path).read_bytes() audio_data = Path(tmp_path).read_bytes()
+4
View File
@@ -19,3 +19,7 @@ unserer memory brain
bilder im chat größer darstellen bilder im chat größer darstellen
# ende # ende
die viper voices downloaden über die diagnostic
# ende