diff --git a/Easydict/Feature/Service/Caiyun/CaiyunService.swift b/Easydict/Feature/Service/Caiyun/CaiyunService.swift index 800ecded6..2c6b3dcf3 100644 --- a/Easydict/Feature/Service/Caiyun/CaiyunService.swift +++ b/Easydict/Feature/Service/Caiyun/CaiyunService.swift @@ -8,7 +8,6 @@ import Alamofire import Foundation -import GoogleGenerativeAI @objc(EZCaiyunService) public final class CaiyunService: QueryService { @@ -80,9 +79,6 @@ public final class CaiyunService: QueryService { "x-authorization": "token " + token, ] - geminiTranslate(text, from: from, to: to, completion: completion) - return - let request = AF.request(apiEndPoint, method: .post, parameters: parameters, @@ -110,34 +106,6 @@ public final class CaiyunService: QueryService { request.cancel() }, serviceType: serviceType().rawValue) } - - public func geminiTranslate(_ text: String, from: Language, to: Language, completion: @escaping (EZQueryResult, Error?) -> Void) { - Task { - // https://github.com/google/generative-ai-swift - do { - var resultString = "" - let prompt = "translate this \(from.rawValue) text into \(to.rawValue): \(text)" - print("gemini prompt: \(prompt)") - let model = GenerativeModel(name: "gemini-pro", apiKey: "") - let outputContentStream = model.generateContentStream(prompt) - - // stream response - for try await outputContent in outputContentStream { - guard let line = outputContent.text else { - return - } - - print("gemini response: \(line)") - resultString += line - result.translatedResults = [resultString] - completion(result, nil) - } - } catch { - print(error.localizedDescription) - completion(result, error) - } - } - } } enum QueryServiceError: Error {