mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-21 11:43:56 +00:00

* feat: rewrite chat context (#3176) * feat: add app auto execute (#3115) * feat: add app auto execute * auto exec configtion * chatting animation * change icon * fix * fix * fix link * feat: add chat context to all chatbox * perf: loading ui --------- Co-authored-by: heheer <heheer@sealos.io> * app auto exec (#3179) * add chat records loaded state (#3184) * perf: chat store reset storage (#3186) * perf: chat store reset storage * perf: auto exec code * chore: workflow ui (#3175) * chore: workflow ui * fix * change icon color config * change popover to mymenu * 4.8.14 test (#3189) * update doc * fix: token check * perf: icon button * update doc * feat: share page support configuration Whether to allow the original view (#3194) * update doc * perf: fix index (#3206) * perf: i18n * perf: Add service entry (#3226) * 4.8.14 test (#3228) * fix: ai log * fix: text splitter * fix: reference unselect & user form description & simple to advance (#3229) * fix: reference unselect & user form description & simple to advance * change abort position * perf * perf: code (#3232) * perf: code * update doc * fix: create btn permission (#3233) * update doc * fix: refresh chatbox listener * perf: check invalid reference * perf: check invalid reference * update doc * fix: ui props --------- Co-authored-by: heheer <heheer@sealos.io>
130 lines
3.4 KiB
JavaScript
130 lines
3.4 KiB
JavaScript
const { i18n } = require('./next-i18next.config');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
const isDev = process.env.NODE_ENV === 'development';
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
basePath: process.env.NEXT_PUBLIC_BASE_URL,
|
|
i18n,
|
|
output: 'standalone',
|
|
reactStrictMode: isDev ? false : true,
|
|
compress: true,
|
|
webpack(config, { isServer, nextRuntime }) {
|
|
Object.assign(config.resolve.alias, {
|
|
'@mongodb-js/zstd': false,
|
|
'@aws-sdk/credential-providers': false,
|
|
snappy: false,
|
|
aws4: false,
|
|
'mongodb-client-encryption': false,
|
|
kerberos: false,
|
|
'supports-color': false,
|
|
'bson-ext': false,
|
|
'pg-native': false
|
|
});
|
|
config.module = {
|
|
...config.module,
|
|
rules: config.module.rules.concat([
|
|
{
|
|
test: /\.svg$/i,
|
|
issuer: /\.[jt]sx?$/,
|
|
use: ['@svgr/webpack']
|
|
},
|
|
{
|
|
test: /\.node$/,
|
|
use: [{ loader: 'nextjs-node-loader' }]
|
|
}
|
|
]),
|
|
exprContextCritical: false,
|
|
unknownContextCritical: false
|
|
};
|
|
|
|
if (!config.externals) {
|
|
config.externals = [];
|
|
}
|
|
|
|
if (isServer) {
|
|
// config.externals.push('@zilliz/milvus2-sdk-node');
|
|
|
|
if (nextRuntime === 'nodejs') {
|
|
const oldEntry = config.entry;
|
|
config = {
|
|
...config,
|
|
async entry(...args) {
|
|
const entries = await oldEntry(...args);
|
|
return {
|
|
...entries,
|
|
...getWorkerConfig(),
|
|
'worker/systemPluginRun': path.resolve(
|
|
process.cwd(),
|
|
'../../packages/plugins/runtime/worker.ts'
|
|
)
|
|
};
|
|
}
|
|
};
|
|
}
|
|
} else {
|
|
config.resolve = {
|
|
...config.resolve,
|
|
fallback: {
|
|
...config.resolve.fallback,
|
|
fs: false
|
|
}
|
|
};
|
|
}
|
|
|
|
config.experiments = {
|
|
asyncWebAssembly: true,
|
|
layers: true
|
|
};
|
|
|
|
return config;
|
|
},
|
|
transpilePackages: ['@fastgpt/*', 'ahooks'],
|
|
experimental: {
|
|
// 优化 Server Components 的构建和运行,避免不必要的客户端打包。
|
|
serverComponentsExternalPackages: ['mongoose', 'pg', '@node-rs/jieba', 'duck-duck-scrape'],
|
|
outputFileTracingRoot: path.join(__dirname, '../../'),
|
|
instrumentationHook: true
|
|
}
|
|
};
|
|
|
|
module.exports = nextConfig;
|
|
|
|
function getWorkerConfig() {
|
|
const result = fs.readdirSync(path.resolve(__dirname, '../../packages/service/worker'));
|
|
|
|
// 获取所有的目录名
|
|
const folderList = result.filter((item) => {
|
|
return fs
|
|
.statSync(path.resolve(__dirname, '../../packages/service/worker', item))
|
|
.isDirectory();
|
|
});
|
|
|
|
/*
|
|
{
|
|
'worker/htmlStr2Md': path.resolve(
|
|
process.cwd(),
|
|
'../../packages/service/worker/htmlStr2Md/index.ts'
|
|
),
|
|
'worker/countGptMessagesTokens': path.resolve(
|
|
process.cwd(),
|
|
'../../packages/service/worker/countGptMessagesTokens/index.ts'
|
|
),
|
|
'worker/readFile': path.resolve(
|
|
process.cwd(),
|
|
'../../packages/service/worker/readFile/index.ts'
|
|
)
|
|
}
|
|
*/
|
|
const workerConfig = folderList.reduce((acc, item) => {
|
|
acc[`worker/${item}`] = path.resolve(
|
|
process.cwd(),
|
|
`../../packages/service/worker/${item}/index.ts`
|
|
);
|
|
return acc;
|
|
}, {});
|
|
return workerConfig;
|
|
}
|