Skip to content

Commit

Permalink
feat: dalle support model list
Browse files Browse the repository at this point in the history
  • Loading branch information
TBXark committed Jan 16, 2025
1 parent 3b75afd commit 0129727
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 24 deletions.
2 changes: 1 addition & 1 deletion dist/buildinfo.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 36 additions & 19 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/lib/core/src/agent/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
} from './types';
import { ImageSupportFormat, loadOpenAIModelList, renderOpenAIMessages } from '#/agent/openai_compatibility';
import { requestChatCompletions } from './request';
import { bearerHeader, convertStringToResponseMessages, getAgentUserConfigFieldName } from './utils';
import {bearerHeader, convertStringToResponseMessages, getAgentUserConfigFieldName, loadModelsList} from './utils';

function openAIApiKey(context: AgentUserConfig): string {
const length = context.OPENAI_API_KEY.length;
Expand Down Expand Up @@ -48,7 +48,7 @@ export class Dalle implements ImageAgent {

readonly enable: AgentEnable = ctx => ctx.OPENAI_API_KEY.length > 0;
readonly model: AgentModel = ctx => ctx.DALL_E_MODEL;
readonly modelList: AgentModelList = ctx => Promise.resolve([ctx.DALL_E_MODEL]);
readonly modelList: AgentModelList = ctx => loadModelsList(ctx.DALL_E_MODEL);

readonly request: ImageAgentRequest = async (prompt: string, context: AgentUserConfig): Promise<string | Blob> => {
const url = `${context.OPENAI_API_BASE}/images/generations`;
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/core/src/config/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const BUILD_TIMESTAMP = 1735091598;
export const BUILD_VERSION = '2b81827';
export const BUILD_TIMESTAMP = 1736996817;
export const BUILD_VERSION = '3b75afd';

0 comments on commit 0129727

Please sign in to comment.