Skip to content

Commit

Permalink
feat: 更新模型映射
Browse files Browse the repository at this point in the history
Change-Id: I4230181b6d2bc8326f8165c3f71e45ef7a59f7b2
  • Loading branch information
ivan-94 committed Jan 18, 2024
1 parent f1ec050 commit 98b61ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/ai/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { createFailResponse } from '../backend-node';
import { handleRequestError } from '../session/api-helper';

import { countToken, countTokenForString } from './encoding';
import { ChatModel, DEFAULT_MAX_TOKEN, MAX_TOKENS, ChatOptions, ErrorResponse } from './constants';
import { ChatModel, DEFAULT_MAX_TOKEN, MAX_TOKENS, ChatOptions, ErrorResponse, ModelPointer } from './constants';
import { ChatCompletion, ChatCompletionInStream } from './types';
import { getChatCompletionSupport } from './platform';
import { checkRequest, RequestControlError } from './request-control';
Expand Down Expand Up @@ -68,7 +68,7 @@ export async function chat(options: ChatOptions) {

const content = {
stream: true,
model,
model: ModelPointer[model] ?? model,
user: support.user,
// max_tokens: maxToken - token,
...other,
Expand Down
8 changes: 8 additions & 0 deletions modules/ai/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ export enum ChatModel {
GPT_4_32K = 'gpt-4-32k',
}

/**
* 模型指针
*/
export const ModelPointer: Record<string, string> = {
[ChatModel.GPT_4]: 'gpt-4-1106-preview',
[ChatModel.GPT_4_32K]: 'gpt-4-1106-preview',
};

export const ALL_SUPPORTED_CHAT_MODEL = [
ChatModel.GPT3_5_TURBO,
ChatModel.GPT3_5_TURBO_16K,
Expand Down

0 comments on commit 98b61ba

Please sign in to comment.