feat: 启动报错

This commit is contained in:
jinyaqiu 2025-07-31 14:09:21 +08:00
parent a0821fc996
commit e6e77f0199
3 changed files with 4 additions and 5 deletions

View File

@ -82,7 +82,7 @@ const MessageItem = ({ setCancel, cancel = true, t, insets, item, sessionId, set
onPress: () => { onPress: () => {
const imageUrl = image?.preview_file_info?.url || image.video?.preview_file_info?.url; const imageUrl = image?.preview_file_info?.url || image.video?.preview_file_info?.url;
if (imageUrl) { if (imageUrl) {
saveMediaToGallery(imageUrl); saveMediaToGallery(imageUrl, t);
} }
}, },
textStyle: { color: '#4C320C' } textStyle: { color: '#4C320C' }

View File

@ -81,7 +81,7 @@ const SelectModel = ({ modalDetailsVisible, setModalDetailsVisible, insets, setS
onPress: () => { onPress: () => {
const imageUrl = item?.file_info?.url || item.video?.file_info?.url; const imageUrl = item?.file_info?.url || item.video?.file_info?.url;
if (imageUrl) { if (imageUrl) {
saveMediaToGallery(imageUrl); saveMediaToGallery(imageUrl, t);
} }
}, },
textStyle: { color: '#4C320C' } textStyle: { color: '#4C320C' }

View File

@ -2,10 +2,9 @@ import { fetchApi } from "@/lib/server-api-util";
import { Message } from "@/types/ask"; import { Message } from "@/types/ask";
import * as FileSystem from 'expo-file-system'; import * as FileSystem from 'expo-file-system';
import * as MediaLibrary from 'expo-media-library'; import * as MediaLibrary from 'expo-media-library';
import { TFunction } from "i18next";
import { useCallback } from "react"; import { useCallback } from "react";
import { useTranslation } from "react-i18next";
import { Alert } from 'react-native'; import { Alert } from 'react-native';
const { t } = useTranslation()
// 实现一个函数,从两个数组中轮流插入新数组 // 实现一个函数,从两个数组中轮流插入新数组
export const mergeArrays = (arr1: any[], arr2: any[]) => { export const mergeArrays = (arr1: any[], arr2: any[]) => {
@ -57,7 +56,7 @@ export const getConversation = async ({
}; };
// 图片 视频 保存到本地 // 图片 视频 保存到本地
export const saveMediaToGallery = async (mediaUrl: string) => { export const saveMediaToGallery = async (mediaUrl: string, t: TFunction) => {
// 声明 fileUri 变量以便在 finally 块中使用 // 声明 fileUri 变量以便在 finally 块中使用
let fileUri: string | null = null; let fileUri: string | null = null;