-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Baidu Api Key And Switch Ali Service type #613
Conversation
…eng#558) Bumps the bundler group with 1 update in the / directory: [rexml](https://github.com/ruby/rexml). Updates `rexml` from 3.2.6 to 3.2.8 - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](ruby/rexml@v3.2.6...v3.2.8) --- updated-dependencies: - dependency-name: rexml dependency-type: indirect dependency-group: bundler ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Conflicts: # Easydict.xcodeproj/project.pbxproj # Easydict/App/Easydict-Bridging-Header.h # Easydict/Swift/Feature/Configuration/Configuration+Defaults.swift # Easydict/Swift/View/SettingView/Tabs/ServiceConfigurationView/ConfigurationView/BaiduTranslate+ConfigurableService.swift
百度通用翻译API接入文档 |
Co-authored-by: tisfeng <[email protected]>
Co-authored-by: tisfeng <[email protected]>
Co-authored-by: tisfeng <[email protected]>
Co-authored-by: tisfeng <[email protected]>
Co-authored-by: tisfeng <[email protected]>
@tisfeng 加了个picker view,做了只有输入appid和key才允许选择api type的逻辑,所以没有做默认选中api type,因为没有appid和key, 默认选中api type也没有意义。 还有我对swiftui和它的观察者模式不是很熟悉,不知道我目前的写法正不正确。 |
你这个整的有点复杂了,而且和单个服务(百度)绑定太死了,其实我是想添加一个通用的 Picker 组件,参考目前 OpenAI 系列的配置,用于处理这种可以同时支持官方 API 和 Web API 的服务,除了百度,还有后面的 Google,阿里翻译等。 |
这个没必要,我希望用户知道这些服务支持官方 API(需要 API key),并且默认使用官方 API,Picker 的选中值是单独存在的,不需要判断用户是否输入了 API key,如果没有,调用对应的 API 请求时应该会报错,我们野直接报错提示就行了。 |
okok,我还想着用户体验呢😄。 |
明白了,你说的也有道理,这里我们可以优化一下报错提示信息,如果当前是选中的是官方 API 类型,并且缺少 API ID 或者 Secret Key,我们可以提前判断并报错,报错时可以明确提示用户这一点,例如提示 “当前正使用 Web API,Secret Key 为空,请前往服务设置页,填写相关配置信息,或切换 API 类型”。 |
@tisfeng 处理了,麻烦重新review一下 |
看了一下,整体没有什么问题,但代码有些地方还是和百度绑定了,不方便扩展,后面阿里也要改成可手动选择 API 类型。 我把 #617 阿里这个修改也给你吧,你看是这次一并改了,或是后面再优化修改也行。 |
...iew/Tabs/ServiceConfigurationView/ConfigurationView/BaiduTranslate+ConfigurableService.swift
Outdated
Show resolved
Hide resolved
...iew/Tabs/ServiceConfigurationView/ConfigurationView/BaiduTranslate+ConfigurableService.swift
Outdated
Show resolved
Hide resolved
- Updated localization keys and values for Baidu API configuration - Refactored `BaiduServiceApiType` enum to `ServiceAPIType` for consistency Signed-off-by: tisfeng <[email protected]>
@tisfeng 目前key找不到给的错误文案里用的是 |
@choykarl 编译报错了,你是不是把 |
sorry,配置文件忘记提交了,因为本地有配置文件的变动,所以没提,忘记有新增文件了。。。 |
This reverts commit 3ec60e9.
我刚已经添加过了。。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Close #484 , #617