From e5eebceea2ccd0bbcec2d7860ed7ed84fa4603ba Mon Sep 17 00:00:00 2001 From: Tisfeng Date: Wed, 10 Apr 2024 00:38:01 +0800 Subject: [PATCH] fix: openai usage status does not work (#501) --- Easydict/Swift/Service/OpenAI/OpenAIService.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Easydict/Swift/Service/OpenAI/OpenAIService.swift b/Easydict/Swift/Service/OpenAI/OpenAIService.swift index c3950614a..d15879d87 100644 --- a/Easydict/Swift/Service/OpenAI/OpenAIService.swift +++ b/Easydict/Swift/Service/OpenAI/OpenAIService.swift @@ -6,10 +6,18 @@ // Copyright © 2023 izual. All rights reserved. // +import Defaults import Foundation // MARK: - OpenAIService -@objcMembers @objc(EZOpenAIService) -public class OpenAIService: BaseOpenAIService {} +class OpenAIService: BaseOpenAIService { + public override func serviceUsageStatus() -> EZServiceUsageStatus { + // swiftlint:disable:next todo + // TODO: Later, we need to support all services to use usage status. + let usageStatus = Defaults[.openAIServiceUsageStatus] + guard let value = UInt(usageStatus.rawValue) else { return .default } + return EZServiceUsageStatus(rawValue: value) ?? .default + } +}