From e6e77f0199d12c7bfb77f4963884acdeeb31c347 Mon Sep 17 00:00:00 2001 From: jinyaqiu Date: Thu, 31 Jul 2025 14:09:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=AF=E5=8A=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ask/aiChat.tsx | 2 +- components/ask/selectModel.tsx | 2 +- components/ask/utils.ts | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/components/ask/aiChat.tsx b/components/ask/aiChat.tsx index 40242f5..1163829 100644 --- a/components/ask/aiChat.tsx +++ b/components/ask/aiChat.tsx @@ -82,7 +82,7 @@ const MessageItem = ({ setCancel, cancel = true, t, insets, item, sessionId, set onPress: () => { const imageUrl = image?.preview_file_info?.url || image.video?.preview_file_info?.url; if (imageUrl) { - saveMediaToGallery(imageUrl); + saveMediaToGallery(imageUrl, t); } }, textStyle: { color: '#4C320C' } diff --git a/components/ask/selectModel.tsx b/components/ask/selectModel.tsx index bf33c36..5ae244a 100644 --- a/components/ask/selectModel.tsx +++ b/components/ask/selectModel.tsx @@ -81,7 +81,7 @@ const SelectModel = ({ modalDetailsVisible, setModalDetailsVisible, insets, setS onPress: () => { const imageUrl = item?.file_info?.url || item.video?.file_info?.url; if (imageUrl) { - saveMediaToGallery(imageUrl); + saveMediaToGallery(imageUrl, t); } }, textStyle: { color: '#4C320C' } diff --git a/components/ask/utils.ts b/components/ask/utils.ts index a000c31..79f046a 100644 --- a/components/ask/utils.ts +++ b/components/ask/utils.ts @@ -2,10 +2,9 @@ import { fetchApi } from "@/lib/server-api-util"; import { Message } from "@/types/ask"; import * as FileSystem from 'expo-file-system'; import * as MediaLibrary from 'expo-media-library'; +import { TFunction } from "i18next"; import { useCallback } from "react"; -import { useTranslation } from "react-i18next"; import { Alert } from 'react-native'; -const { t } = useTranslation() // 实现一个函数,从两个数组中轮流插入新数组 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 块中使用 let fileUri: string | null = null;