Skip to content

Commit

Permalink
support openai translate service multiple instances
Browse files Browse the repository at this point in the history
  • Loading branch information
xtyuns committed Jun 4, 2024
1 parent bff5a15 commit 23188ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/services/translate/openai/Config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { translate } from './index';
import { Language } from './index';

export function Config(props) {
const { updateServiceList, onClose } = props;
const { instanceKey, updateServiceList, onClose } = props;
const [openaiConfig, setOpenaiConfig] = useConfig(
'openai',
instanceKey,
{
service: 'openai',
requestPath: 'https://api.openai.com/v1/chat/completions',
Expand Down Expand Up @@ -67,7 +67,7 @@ export function Config(props) {
() => {
setIsLoading(false);
setOpenaiConfig(openaiConfig, true);
updateServiceList('openai');
updateServiceList(instanceKey);
onClose();
},
(e) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as builtinServices from '../../../../../../services/translate';
import { PluginConfig } from '../../PluginConfig';

export default function ConfigModal(props) {
const { isOpen, onOpenChange, serviceInstanceKey, serviceSourceType, serviceName, updateServiceList, pluginList } = props;
const { isOpen, onOpenChange, serviceInstanceKey, serviceSourceType, serviceName, updateServiceInstanceList, pluginList } = props;

const { t } = useTranslation();
const ConfigComponent = serviceSourceType === 'plugin' ? PluginConfig : builtinServices[serviceName].Config;
Expand Down Expand Up @@ -53,7 +53,7 @@ export default function ConfigModal(props) {
instanceKey={serviceInstanceKey}
pluginType='translate'
pluginList={pluginList}
updateServiceList={updateServiceList}
updateServiceList={updateServiceInstanceList}
onClose={onClose}
/>
</ModalBody>
Expand Down
2 changes: 1 addition & 1 deletion src/window/Config/pages/Service/Translate/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default function Translate(props) {
isOpen={isConfigOpen}
pluginList={pluginList}
onOpenChange={onConfigOpenChange}
updateServiceList={updateServiceInstanceList}
updateServiceInstanceList={updateServiceInstanceList}
/>
</>
);
Expand Down

0 comments on commit 23188ab

Please sign in to comment.