Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ S3_PORT=9000
S3_USE_SSL=false
S3_ACCESS_KEY=minioadmin
S3_SECRET_KEY=minioadmin
S3_PLIGIN_BUCKET=fastgpt-uploads
S3_BUCKET=files

# Signoz
SIGNOZ_BASE_URL=
SIGNOZ_SERVICE_NAME=fastgpt-plugin

# MongoDB connection string
# Replace 'myusername' and 'mypassword' with your actual MongoDB credentials
# Replace 'myusername' and 'mypassword' with your actual MongoDB credentials and ensure the database 'fastgpt' exists.
MONGODB_URI=mongodb://myusername:mypassword@localhost:27017/fastgpt?authSource=admin&directConnection=true
MONGO_DATABASE_NAME=fastgpt
MONGO_MAX_LINK=
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ dist
node_modules
.DS_Store
public/imgs/tools/
.local/
pnpm-lock.yaml
.local
pnpm-lock.yaml
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"editor.formatOnSave": true,
"editor.mouseWheelZoom": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.prettierPath": "node_modules/prettier",
"typescript.tsdk": "node_modules/typescript/lib",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Deeply **modularize** FastGPT to achieve maximum **extensibility**.

## Documentation & Development Guides

- [Plugin design document](https://doc.tryfastgpt.ai/docs/development/design/design_plugin)
- [System tool development guide](https://doc.tryfastgpt.ai/docs/guide/plugins/dev_system_tool)
- [Plugin design document](https://doc.tryfastgpt.ai/docs/introduction/development/design/design_plugin)
- [System tool development guide](https://doc.tryfastgpt.ai/docs/introduction/guide/plugins/dev_system_tool)
- [Development Specifications](./dev.md)
4 changes: 2 additions & 2 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ FastGPT 已有系统工具已经迁移到这个仓库,新工具也将在这个

## 文档

- [系统工具开发指南](https://doc.tryfastgpt.ai/docs/guide/plugins/dev_system_tool)
- [设计文档](https://doc.tryfastgpt.ai/docs/development/design/design_plugin)
- [系统工具开发指南](https://doc.tryfastgpt.ai/docs/introduction/guide/plugins/dev_system_tool)
- [设计文档](https://doc.tryfastgpt.ai/docs/introduction/development/design/design_plugin)
- [开发规范](./dev_zh_CN.md)
368 changes: 267 additions & 101 deletions bun.lock

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions modules/model/api/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { s } from '@/router/init';
import { contract } from '@/contract';
import { modelsBuffer } from '../constants';

export const getModelsHandler = s.route(contract.model.list, async () => {
return {
status: 200,
body: modelsBuffer.data
};
});
6 changes: 6 additions & 0 deletions modules/model/api/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { z } from 'zod';
import { ModelItemSchema } from '../type';

// 保留原有的 listModelsSchema
export const listModelsSchema = z.array(ModelItemSchema);
export type ListModelsType = z.infer<typeof listModelsSchema>;
7 changes: 7 additions & 0 deletions modules/model/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { ListModelsType } from './api/type';

export const modelsBuffer: {
data: ListModelsType;
} = {
data: []
};
24 changes: 24 additions & 0 deletions modules/model/contract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import z from 'zod';
import { c } from '@/contract/init';
import { type ListModelsType } from './api/type';

export const modelContract = c.router(
{
list: {
path: '/list',
method: 'GET',
description: 'Get model list',
responses: {
200: c.type<ListModelsType>()
}
}
},
{
pathPrefix: '/model',
commonResponse: {
500: z.object({
error: z.string()
})
}
}
);
91 changes: 91 additions & 0 deletions modules/model/init.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import alicloud from './provider/alicloud';
import baai from './provider/baai';
import baichuan from './provider/baichuan';
import chatglm from './provider/chatglm';
import claude from './provider/claude';
import deepseek from './provider/deepseek';
import doubao from './provider/doubao';
import ernie from './provider/ernie';
import fishaudio from './provider/fishaudio';
import gemini from './provider/gemini';
import grok from './provider/grok';
import groq from './provider/groq';
import hunyuan from './provider/hunyuan';
import intern from './provider/intern';
import jina from './provider/jina';
import meta from './provider/meta';
import minimax from './provider/minimax';
import mistralai from './provider/mistralai';
import moka from './provider/moka';
import moonshot from './provider/moonshot';
import ollama from './provider/ollama';
import openai from './provider/openai';
import other from './provider/other';
import ppio from './provider/ppio';
import qwen from './provider/qwen';
import siliconflow from './provider/siliconflow';
import sparkdesk from './provider/sparkdesk';
import stepfun from './provider/stepfun';
import yi from './provider/yi';

import { ModelItemSchema, ModelTypeEnum, type ProviderConfigType } from './type';
import { modelsBuffer } from './constants';
import { addLog } from '@/utils/log';

// All providers array in alphabetical order
const allProviders: ProviderConfigType[] = [
alicloud,
baai,
baichuan,
chatglm,
claude,
deepseek,
doubao,
ernie,
fishaudio,
gemini,
grok,
groq,
hunyuan,
intern,
jina,
meta,
minimax,
mistralai,
moka,
moonshot,
ollama,
openai,
other,
ppio,
qwen,
siliconflow,
sparkdesk,
stepfun,
yi
];

export const initModels = () => {
modelsBuffer.data = allProviders
.map((item) => {
return item.list.map((model) => {
return ModelItemSchema.parse({
...(model.type === ModelTypeEnum.llm && {
showTopP: true,
showStopSign: true,
datasetProcess: true,
usedInClassify: true,
usedInExtractFields: true,
usedInToolCall: true,
useInEvaluation: true
}),
...model,
provider: item.provider,
name: model.model
});
});
})
.flat();

addLog.info(`Load system model success, total ${modelsBuffer.data.length} models`);
};
14 changes: 14 additions & 0 deletions modules/model/provider/alicloud.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ModelTypeEnum, type ProviderConfigType } from '../type';

const models: ProviderConfigType = {
provider: 'AliCloud',
list: [
{
model: 'SenseVoiceSmall',
name: 'SenseVoiceSmall',
type: ModelTypeEnum.stt
}
]
};

export default models;
19 changes: 19 additions & 0 deletions modules/model/provider/baai.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ModelTypeEnum, type ProviderConfigType } from '../type';

const models: ProviderConfigType = {
provider: 'BAAI',
list: [
{
type: ModelTypeEnum.embedding,
model: 'bge-m3',
defaultToken: 512,
maxToken: 8000
},
{
type: ModelTypeEnum.rerank,
model: 'bge-reranker-v2-m3'
}
]
};

export default models;
8 changes: 8 additions & 0 deletions modules/model/provider/baichuan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ModelTypeEnum, type ProviderConfigType } from '../type';

const models: ProviderConfigType = {
provider: 'Baichuan',
list: []
};

export default models;
Loading