feat: return endpoint config from server

This commit is contained in:
Wentao Lyu 2023-04-01 14:33:07 +08:00
parent b687ab30ed
commit 60be4f12b7
4 changed files with 25 additions and 13 deletions

View file

@ -1,12 +1,23 @@
import { atom, selector } from 'recoil';
const endpointsFilter = atom({
key: 'endpointsFilter',
const endpointsConfig = atom({
key: 'endpointsConfig',
default: {
azureOpenAI: false,
openAI: false,
bingAI: false,
chatGPTBrowser: false
azureOpenAI: null,
openAI: null,
bingAI: null,
chatGPTBrowser: null
}
});
const endpointsFilter = selector({
key: 'endpointsFilter',
get: ({ get }) => {
const config = get(endpointsConfig) || {};
let filter = {};
for (const key of Object.keys(config)) filter[key] = !!config[key];
return filter;
}
});
@ -21,6 +32,7 @@ const availableEndpoints = selector({
// const modelAvailable
export default {
endpointsConfig,
endpointsFilter,
availableEndpoints
};