agent功能开发增加MCP后端
This commit is contained in:
@@ -220,19 +220,20 @@ const AgentChatV3 = () => {
|
||||
const handleSendMessage = async () => {
|
||||
if (!inputValue.trim() || isProcessing) return;
|
||||
|
||||
// 权限检查 - 检查 username 或 id
|
||||
const isMaxUser = user?.username === 'max' || user?.id === 'max' || user?.id === 1;
|
||||
// 权限检查 - 检查订阅类型(与Community等页面保持一致)
|
||||
const hasAccess = user?.subscription_type === 'max' || user?.subscription_type === 'pro';
|
||||
|
||||
if (!isMaxUser) {
|
||||
if (!hasAccess) {
|
||||
logger.warn('AgentChat', '权限检查失败', {
|
||||
userId: user?.id,
|
||||
username: user?.username,
|
||||
subscription_type: user?.subscription_type,
|
||||
userObject: user
|
||||
});
|
||||
|
||||
toast({
|
||||
title: '权限不足',
|
||||
description: '「价小前投研」功能目前仅对特定用户开放。如需使用,请联系管理员。',
|
||||
title: '订阅升级',
|
||||
description: '「价小前投研」功能需要 Pro 或 Max 订阅。请前往设置页面升级您的订阅。',
|
||||
status: 'warning',
|
||||
duration: 5000,
|
||||
isClosable: true,
|
||||
@@ -240,7 +241,11 @@ const AgentChatV3 = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info('AgentChat', '权限检查通过', { userId: user?.id, username: user?.username });
|
||||
logger.info('AgentChat', '权限检查通过', {
|
||||
userId: user?.id,
|
||||
username: user?.username,
|
||||
subscription_type: user?.subscription_type
|
||||
});
|
||||
|
||||
const userMessage = {
|
||||
type: MessageTypes.USER,
|
||||
|
||||
Reference in New Issue
Block a user