feat(openai): add list models dynamic data

This commit is contained in:
Ali BARIN
2023-01-17 22:17:06 +01:00
parent 1e137f0bd8
commit 49755303f7
3 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
import listModels from './list-models';
export default [listModels];

View File

@@ -0,0 +1,19 @@
import { IGlobalVariable } from '@automatisch/types';
export default {
name: 'List models',
key: 'listModels',
async run($: IGlobalVariable) {
const response = await $.http.get('/v1/models');
const models = response.data.data.map((model: { id: string }) => {
return {
value: model.id,
name: model.id,
};
});
return { data: models };
},
};

View File

@@ -2,6 +2,7 @@ import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import actions from './actions';
import dynamicData from './dynamic-data';
export default defineApp({
name: 'OpenAI',
@@ -15,4 +16,5 @@ export default defineApp({
beforeRequest: [addAuthHeader],
auth,
actions,
dynamicData,
});