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

✨ feat: support configuring multiple agent index urls #1648

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LeoQuote
Copy link

@LeoQuote LeoQuote commented Mar 19, 2024

fix #1559

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • ⚡️ perf
  • 📝 docs

🔀 变更说明 | Description of Change

新增了多个 market 中心的支持, 支持方式如下:

接口层面, market index api 会尝试将 AGENTS_INDEX_URL 用逗号分开, 然后逐个请求, 最后将其合并( 不去重 )

market api 会接受新的参数 ,marketId, 使用 identifier, marketId 这两个参数, 可以前往不同的 market 获取相关信息, 在获取到信息后, 将 marketId 再重新注入到返回体内返回给前端

UI 层面, 在点击卡片时, 会set 两个 store, currentIdentifier , currentMarketId, 最后关联到 url 上, 即可请求到正确的资源

新增多个 plugin 中心的支持, 更改较少, 仅需更改 api, 在后端分别请求两个 index 即可.

验证方式:
设置环境变量

AGENTS_INDEX_URL=https://chat-agents.lobehub.com,https://chat-agents.lobehub.com
PLUGINS_INDEX_URL=https://chat-plugins.lobehub.com,https://chat-plugins.lobehub.com

启动服务, 观察到有重复的两波 agent 和插件, 符合预期

📝 补充信息 | Additional Information

Copy link

vercel bot commented Mar 19, 2024

@LeoQuote is attempting to deploy a commit to the LobeHub Team on Vercel.

A member of the Team first needs to authorize it.

@lobehubbot
Copy link
Member

👍 @LeoQuote

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@LeoQuote LeoQuote changed the title ⚡ feat: Add marketId to AgentsMarketIndexItem and use it ✨ feat: Add marketId to AgentsMarketIndexItem and use it Mar 19, 2024
@LeoQuote LeoQuote changed the title ✨ feat: Add marketId to AgentsMarketIndexItem and use it ✨ feat: support configuring multiple agent index url Mar 19, 2024
@LeoQuote LeoQuote changed the title ✨ feat: support configuring multiple agent index url ✨ feat: support configuring multiple agent index urls Mar 19, 2024
@LeoQuote LeoQuote marked this pull request as draft March 20, 2024 06:22
@LeoQuote LeoQuote marked this pull request as ready for review March 20, 2024 06:31
Copy link

codecov bot commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.58%. Comparing base (04d8e53) to head (dfe3dfb).
Report is 70 commits behind head on main.

❗ Current head dfe3dfb differs from pull request most recent head 6b2aea3. Consider uploading reports for the commit 6b2aea3 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1648   +/-   ##
=======================================
  Coverage   92.57%   92.58%           
=======================================
  Files         239      239           
  Lines       13066    13066           
  Branches     1562     1562           
=======================================
+ Hits        12096    12097    +1     
+ Misses        970      969    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@arvinxx
Copy link
Contributor

arvinxx commented Apr 1, 2024

marketId 是不是应该也支持字符串?这样的话可以实现用 id 来控制,以及后续让用户手动添加不同的助手市场?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Should marketId also support strings? In this case, it is possible to use id to control, and then allow users to manually add different assistant markets?

@LeoQuote
Copy link
Author

LeoQuote commented Apr 1, 2024

配置不太好做,这个设计是用逗号分隔,用index 做market id,如果想加入名字,需要改成字典配置,有点麻烦了

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The configuration is not easy to do. This design uses commas to separate and use index as the market ID. If you want to add a name, you need to change it to a dictionary configuration, which is a bit troublesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] 支持设置多个插件 index, agent index
3 participants