mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
V4.7-alpha (#985)
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
export enum ChatCompletionRequestMessageRoleEnum {
|
||||
'System' = 'system',
|
||||
'User' = 'user',
|
||||
'Assistant' = 'assistant',
|
||||
'Function' = 'function',
|
||||
'Tool' = 'tool'
|
||||
}
|
27
packages/global/core/ai/constants.ts
Normal file
27
packages/global/core/ai/constants.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
export enum ChatCompletionRequestMessageRoleEnum {
|
||||
'System' = 'system',
|
||||
'User' = 'user',
|
||||
'Assistant' = 'assistant',
|
||||
'Function' = 'function',
|
||||
'Tool' = 'tool'
|
||||
}
|
||||
|
||||
export enum ChatMessageTypeEnum {
|
||||
text = 'text',
|
||||
image_url = 'image_url'
|
||||
}
|
||||
|
||||
export enum LLMModelTypeEnum {
|
||||
all = 'all',
|
||||
classify = 'classify',
|
||||
extractFields = 'extractFields',
|
||||
toolCall = 'toolCall',
|
||||
queryExtension = 'queryExtension'
|
||||
}
|
||||
export const llmModelTypeFilterMap = {
|
||||
[LLMModelTypeEnum.all]: 'model',
|
||||
[LLMModelTypeEnum.classify]: 'usedInClassify',
|
||||
[LLMModelTypeEnum.extractFields]: 'usedInExtractFields',
|
||||
[LLMModelTypeEnum.toolCall]: 'usedInToolCall',
|
||||
[LLMModelTypeEnum.queryExtension]: 'usedInQueryExtension'
|
||||
};
|
8
packages/global/core/ai/model.d.ts
vendored
8
packages/global/core/ai/model.d.ts
vendored
@@ -10,7 +10,13 @@ export type LLMModelItemType = {
|
||||
|
||||
censor?: boolean;
|
||||
vision?: boolean;
|
||||
datasetProcess?: boolean;
|
||||
|
||||
// diff function model
|
||||
datasetProcess?: boolean; // dataset
|
||||
usedInClassify?: boolean; // classify
|
||||
usedInExtractFields?: boolean; // extract fields
|
||||
usedInToolCall?: boolean; // tool call
|
||||
usedInQueryExtension?: boolean; // query extension
|
||||
|
||||
functionCall: boolean;
|
||||
toolChoice: boolean;
|
||||
|
36
packages/global/core/ai/type.d.ts
vendored
36
packages/global/core/ai/type.d.ts
vendored
@@ -1,20 +1,33 @@
|
||||
import openai from 'openai';
|
||||
import type {
|
||||
ChatCompletion,
|
||||
ChatCompletionCreateParams,
|
||||
ChatCompletionMessageToolCall,
|
||||
ChatCompletionChunk,
|
||||
ChatCompletionMessageParam,
|
||||
ChatCompletionContentPart
|
||||
ChatCompletionToolMessageParam,
|
||||
ChatCompletionAssistantMessageParam
|
||||
} from 'openai/resources';
|
||||
import { ChatMessageTypeEnum } from './constants';
|
||||
|
||||
export type ChatCompletionContentPart = ChatCompletionContentPart;
|
||||
export type ChatCompletionCreateParams = ChatCompletionCreateParams;
|
||||
export type ChatMessageItemType = Omit<ChatCompletionMessageParam, 'name'> & {
|
||||
name?: any;
|
||||
export * from 'openai/resources';
|
||||
|
||||
export type ChatCompletionMessageParam = ChatCompletionMessageParam & {
|
||||
dataId?: string;
|
||||
content: any;
|
||||
} & any;
|
||||
};
|
||||
export type ChatCompletionToolMessageParam = ChatCompletionToolMessageParam & { name: string };
|
||||
export type ChatCompletionAssistantToolParam = {
|
||||
role: 'assistant';
|
||||
tool_calls: ChatCompletionMessageToolCall[];
|
||||
};
|
||||
|
||||
export type ChatCompletion = ChatCompletion;
|
||||
export type ChatCompletionMessageToolCall = ChatCompletionMessageToolCall & {
|
||||
toolName?: string;
|
||||
toolAvatar?: string;
|
||||
};
|
||||
export type ChatCompletionMessageFunctionCall = ChatCompletionAssistantMessageParam.FunctionCall & {
|
||||
id?: string;
|
||||
toolName?: string;
|
||||
toolAvatar?: string;
|
||||
};
|
||||
export type StreamChatType = Stream<ChatCompletionChunk>;
|
||||
|
||||
export type PromptTemplateItem = {
|
||||
@@ -22,3 +35,6 @@ export type PromptTemplateItem = {
|
||||
desc: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export default openai;
|
||||
export * from 'openai';
|
||||
|
Reference in New Issue
Block a user