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