Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

using tauri http api run plugin to fixed cors in App #6

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

lloydzhou
Copy link

💻 变更类型 | Change Type

  • feat
  • fix
  • refactor
  • perf
  • style
  • test
  • docs
  • ci
  • chore
  • build

🔀 变更说明 | Description of Change

📝 补充信息 | Additional Information

}}
></input>
</ListItem>
{!getClientConfig()?.isApp && (
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APP端不显示 解决 cors的选项

@@ -61,6 +62,7 @@ export const FunctionToolService = {
const api = new OpenAPIClientAxios({
definition: yaml.load(plugin.content) as any,
axiosConfigDefaults: {
adapter: adapter as any,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里使用自定义的adapter

@@ -285,3 +287,34 @@ export function showPlugins(provider: ServiceProvider, model: string) {
}
return false;
}

export function fetch(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里尝试使用 @tauri-apps/api/http内部的fetch,这个fetch支持跨域

@@ -50,6 +50,11 @@
},
"notification": {
"all": true
},
"http": {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

启用 http api

@lloydzhou
Copy link
Author

测试App内可以使用跨域的插件
img_v3_02ed_97fc0e9f-1e4c-4273-94e2-03b67f67abfg

@Issues-translate-bot

This comment was marked as outdated.

@lloydzhou lloydzhou requested a review from Dogtiti September 4, 2024 13:39
@lloydzhou lloydzhou merged commit 9820193 into feature/plugin Sep 4, 2024
1 check failed
@lloydzhou lloydzhou deleted the feature/plugin-app-cors branch September 26, 2024 13:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants