Skip to content
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

页尾一言api无法输出自定义类型 #1041

Closed
Deepseaon opened this issue Jan 3, 2025 · 9 comments
Closed

页尾一言api无法输出自定义类型 #1041

Deepseaon opened this issue Jan 3, 2025 · 9 comments
Labels
bug Something isn't working

Comments

@Deepseaon
Copy link

问题出处:
页尾一言

实际行为描述:

使用比如["https://v1.hitokoto.cn/?c=i&encode=json"]保存设置并刷新缓存后,随机内容依旧是任意类型而不是i(诗词)
控制台查看对应请求为https://v1.hitokoto.cn/,发现并未传参?c=i

预期的行为:
正常传参

复现步骤:

如需要可以提供地址

配置与环境:

  • wordpress6.7.1
  • 主题版本latest

截图(若有)

补充信息:

@Deepseaon Deepseaon added the bug Something isn't working label Jan 3, 2025
Copy link

github-actions bot commented Jan 3, 2025

@Deepsea-CN,感谢你给 sakurairo 提出了 issue。ヾ(≧▽≦*)o
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@KotoriK
Copy link
Collaborator

KotoriK commented Jan 20, 2025

根据源码,或许可以试一下,写配置时用双引号包裹url看看输出是否正常

'yiyan_api' => empty(iro_opt('yiyan')) ? ["https://v1.hitokoto.cn/", "https://api.nmxc.ltd/yiyan/"] : json_decode(iro_opt('yiyan_api')),

可以打开console确认一下_iro.yiyan_api的值
https://github.com/Fuukei/Sakurairo_Scripts/blob/2e410e47c0e8515404e6579367cf8fb2da90c1da/src/app/hitokoto.ts#L4

@Deepseaon
Copy link
Author

Deepseaon commented Jan 20, 2025

主题设置中我就只在默认值的基础上做了点修改,然后加了一个/?c=i的参数,url都是用双引号包裹的

Image
但是奇怪的是api输出的依旧是默认值,并不是我在设置中修改的值,看起来他始终使用默认数组覆盖配置

Image

@KotoriK
Copy link
Collaborator

KotoriK commented Jan 20, 2025

对哦我都没发现 你看empty()检查的是"yiyan",而实际用的key是"yiyan_api"😀😀😀

@KotoriK
Copy link
Collaborator

KotoriK commented Jan 20, 2025

麻烦改下试试可不可以用

@Deepseaon
Copy link
Author

麻烦改下试试可不可以用

Image
补全_api后正常了,确认是这个判断逻辑的问题

@KotoriK
Copy link
Collaborator

KotoriK commented Jan 20, 2025

麻烦改下试试可不可以用

Image 补全_api后正常了,确认是这个判断逻辑的问题

好欸
可以直接点击修改提个pr👏

@Deepseaon

This comment has been minimized.

@bymoye
Copy link
Collaborator

bymoye commented Jan 23, 2025

该问题已在 5698374 被修复

@bymoye bymoye closed this as completed Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants