-
-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 fix: fix agent market index not work with docker
- Loading branch information
Showing
14 changed files
with
117 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import urlJoin from 'url-join'; | ||
|
||
import { getServerConfig } from '@/config/server'; | ||
import { DEFAULT_LANG, checkLang } from '@/const/locale'; | ||
import { Locales } from '@/locales/resources'; | ||
|
||
export class AgentMarket { | ||
private readonly baseUrl: string; | ||
|
||
constructor(baseUrl?: string) { | ||
this.baseUrl = baseUrl || getServerConfig().AGENTS_INDEX_URL; | ||
} | ||
|
||
getAgentIndexUrl = (lang: Locales = DEFAULT_LANG) => { | ||
if (checkLang(lang)) return this.baseUrl; | ||
|
||
return urlJoin(this.baseUrl, `index.${lang}.json`); | ||
}; | ||
|
||
getAgentUrl = (identifier: string, lang: Locales = DEFAULT_LANG) => { | ||
if (checkLang(lang)) return urlJoin(this.baseUrl, `${identifier}.json`); | ||
|
||
return urlJoin(this.baseUrl, `${identifier}.${lang}.json`); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { URLS } from '@/services/_url'; | ||
import { LobeChatAgentsMarketIndex } from '@/types/market'; | ||
|
||
class MarketService { | ||
getAgentList = async (locale: string): Promise<LobeChatAgentsMarketIndex> => { | ||
const res = await fetch(`${URLS.market}?locale=${locale}`); | ||
|
||
return res.json(); | ||
}; | ||
|
||
/** | ||
* 请求助手 manifest | ||
*/ | ||
getAgentManifest = async (identifier: string, locale: string) => { | ||
if (!identifier) return; | ||
const res = await fetch(`${URLS.market}/${identifier}?locale=${locale}`); | ||
|
||
return res.json(); | ||
}; | ||
} | ||
export const marketService = new MarketService(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters