添加交叉评查菜单页面,添加单点登录相关逻辑(待完善)
This commit is contained in:
+12
-11
@@ -32,18 +32,19 @@ interface ApiConfig {
|
||||
const configs: Record<string, ApiConfig> = {
|
||||
// 开发环境
|
||||
development: {
|
||||
// baseUrl: 'http://172.16.0.55:8008',
|
||||
baseUrl: 'http://172.16.0.55:8008',
|
||||
// baseUrl: 'http://172.16.0.81:3000',
|
||||
baseUrl: 'http://nas.7bm.co:3000',
|
||||
documentUrl: 'http://172.16.0.81:9000/docauditai/',
|
||||
// baseUrl: 'http://nas.7bm.co:3000',
|
||||
// documentUrl: 'http://172.16.0.81:9000/docauditai/',
|
||||
documentUrl: 'http://172.16.0.55:8008/docauditai/',
|
||||
uploadUrl: 'http://172.16.0.55:8008/admin/documents',
|
||||
// uploadUrl: 'http://172.16.0.58:8008/admin/documents',
|
||||
// uploadUrl: 'http://172.16.0.58:8008/admin/documents',
|
||||
oauth: {
|
||||
serverUrl: 'http://10.79.112.85', // IDaaS服务器地址
|
||||
clientId: '54d2a619fe5c81ae1250434c441fccccqMtKwh7H4fO', // 需要替换为实际的Client ID
|
||||
clientSecret: 'your_client_secret', // 需要替换为实际的Client Secret
|
||||
redirectUri: 'http://localhost:3000/callback', // 回调地址
|
||||
clientId: '54d2a619fe5c81ae1250434c441fccccqMtKwh7H4fO',
|
||||
clientSecret: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb', // 需要替换为实际的Client Secret
|
||||
redirectUri: 'http://10.79.97.17/', // 回调地址
|
||||
appId: 'idaasoauth2' // 应用ID,用于登出
|
||||
}
|
||||
},
|
||||
@@ -65,16 +66,16 @@ const configs: Record<string, ApiConfig> = {
|
||||
// 生产环境
|
||||
production: {
|
||||
// postgrest
|
||||
baseUrl: 'http://10.79.97.16:8000',
|
||||
baseUrl: 'http://10.79.97.17:8000',
|
||||
// minio
|
||||
documentUrl: 'http://10.76.244.156:9000/docauditai/',
|
||||
// 文件上传
|
||||
uploadUrl: 'http://10.79.97.16:8000/admin/documents/upload',
|
||||
uploadUrl: 'http://10.79.97.17:8000/admin/documents',
|
||||
oauth: {
|
||||
serverUrl: 'http://10.79.112.85', // IDaaS服务器地址
|
||||
clientId: '54d2a619fe5c81ae1250434c441fccccqMtKwh7H4fO', // 需要替换为实际的Client ID
|
||||
clientSecret: 'your_client_secret', // 需要替换为实际的Client Secret
|
||||
redirectUri: 'http://10.79.97.17/callback', // 回调地址
|
||||
clientId: '54d2a619fe5c81ae1250434c441fccccqMtKwh7H4fO',
|
||||
clientSecret: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb', // 需要替换为实际的Client Secret
|
||||
redirectUri: 'http://10.79.97.17/', // 回调地址
|
||||
appId: 'idaasoauth2' // 应用ID,用于登出
|
||||
}
|
||||
},
|
||||
|
||||
+23
-19
@@ -28,16 +28,9 @@ const extractAppId = (appUrl: string): string => {
|
||||
return appUrl;
|
||||
};
|
||||
|
||||
// 获取配置值并添加调试日志
|
||||
const getApiUrl = () => {
|
||||
// 在Remix中,我们使用本地API路由作为代理,而不是直接访问Dify API
|
||||
if (typeof window !== 'undefined') {
|
||||
// 客户端:使用相对路径访问本地API
|
||||
return '/api';
|
||||
} else {
|
||||
// 服务端:也使用相对路径
|
||||
return '/api';
|
||||
}
|
||||
// 获取Dify API配置
|
||||
const getDifyApiUrl = () => {
|
||||
return getEnvVar('NEXT_PUBLIC_API_URL', 'https://api.dify.ai/v1');
|
||||
};
|
||||
|
||||
const getAppId = () => {
|
||||
@@ -46,22 +39,36 @@ const getAppId = () => {
|
||||
// console.log('🔧 Chat Config Debug:', {
|
||||
// rawAppId,
|
||||
// extractedAppId,
|
||||
// apiUrl: getApiUrl(),
|
||||
// difyApiUrl: getDifyApiUrl(),
|
||||
// hasApiKey: !!getEnvVar('NEXT_PUBLIC_APP_KEY', ''),
|
||||
// difyApiUrl: getEnvVar('NEXT_PUBLIC_API_URL', ''),
|
||||
// });
|
||||
return extractedAppId;
|
||||
};
|
||||
|
||||
// 生成用户ID (模拟服务端逻辑)
|
||||
const generateUserId = () => {
|
||||
const appId = getAppId();
|
||||
// 生成或获取会话ID (可以使用localStorage或其他方式)
|
||||
let sessionId = '';
|
||||
if (typeof window !== 'undefined') {
|
||||
sessionId = localStorage.getItem('dify_session_id') || '';
|
||||
if (!sessionId) {
|
||||
sessionId = 'sess_' + Math.random().toString(36).substring(2, 15);
|
||||
localStorage.setItem('dify_session_id', sessionId);
|
||||
}
|
||||
}
|
||||
return `user_${appId}:${sessionId}`;
|
||||
};
|
||||
|
||||
// 聊天应用配置
|
||||
export const CHAT_CONFIG = {
|
||||
// API相关配置 - 使用本地API路由作为代理
|
||||
API_URL: getApiUrl(),
|
||||
// API相关配置 - 直接使用Dify API
|
||||
API_URL: getDifyApiUrl(),
|
||||
APP_ID: getAppId(),
|
||||
API_KEY: getEnvVar('NEXT_PUBLIC_APP_KEY', ''),
|
||||
|
||||
// Dify API 配置(用于服务端)
|
||||
DIFY_API_URL: getEnvVar('NEXT_PUBLIC_API_URL', 'https://api.dify.ai/v1'),
|
||||
// 用户生成函数
|
||||
generateUserId,
|
||||
|
||||
// 应用信息
|
||||
APP_INFO: {
|
||||
@@ -76,9 +83,6 @@ export const CHAT_CONFIG = {
|
||||
isShowPrompt: false,
|
||||
promptTemplate: 'I want you to act as a javascript console.',
|
||||
|
||||
// API相关
|
||||
API_PREFIX: '/api',
|
||||
|
||||
// 本地化
|
||||
LOCALE_COOKIE_NAME: 'locale',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user