mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-30 11:55:12 +00:00
chore: update gmail toolkit name
This commit is contained in:
parent
8f657c43eb
commit
774f2d27ad
9 changed files with 46 additions and 46 deletions
|
|
@ -315,9 +315,9 @@ class GoogleGmailNativeToolkit(BaseGmailToolkit, AbstractToolkit):
|
|||
|
||||
# If no token file, try environment variables
|
||||
if not creds:
|
||||
client_id = env("GOOGLE_CLIENT_ID")
|
||||
client_secret = env("GOOGLE_CLIENT_SECRET")
|
||||
refresh_token = env("GOOGLE_REFRESH_TOKEN")
|
||||
client_id = env("GMAIL_GOOGLE_CLIENT_ID")
|
||||
client_secret = env("GMAIL_GOOGLE_CLIENT_SECRET")
|
||||
refresh_token = env("GMAIL_GOOGLE_REFRESH_TOKEN")
|
||||
token_uri = env("GOOGLE_TOKEN_URI", "https://oauth2.googleapis.com/token")
|
||||
|
||||
if refresh_token and client_id and client_secret:
|
||||
|
|
@ -390,14 +390,14 @@ class GoogleGmailNativeToolkit(BaseGmailToolkit, AbstractToolkit):
|
|||
state.status = "authorizing"
|
||||
oauth_state_manager.update_status("google_gmail", "authorizing")
|
||||
|
||||
client_id = env("GOOGLE_CLIENT_ID")
|
||||
client_secret = env("GOOGLE_CLIENT_SECRET")
|
||||
client_id = env("GMAIL_GOOGLE_CLIENT_ID")
|
||||
client_secret = env("GMAIL_GOOGLE_CLIENT_SECRET")
|
||||
token_uri = env("GOOGLE_TOKEN_URI", "https://oauth2.googleapis.com/token")
|
||||
|
||||
logger.info(f"Google Gmail auth - client_id present: {bool(client_id)}, client_secret present: {bool(client_secret)}")
|
||||
|
||||
if not client_id or not client_secret:
|
||||
error_msg = "GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET must be set in environment variables"
|
||||
error_msg = "GMAIL_GOOGLE_CLIENT_ID and GMAIL_GOOGLE_CLIENT_SECRET must be set in environment variables"
|
||||
logger.error(error_msg)
|
||||
raise ValueError(error_msg)
|
||||
|
||||
|
|
@ -488,9 +488,9 @@ class GoogleGmailNativeToolkit(BaseGmailToolkit, AbstractToolkit):
|
|||
def get_can_use_tools(cls, api_task_id: str) -> list[FunctionTool]:
|
||||
"""Check if Gmail toolkit can be used and return available tools.
|
||||
|
||||
Requires GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET environment variables.
|
||||
Requires GMAIL_GOOGLE_CLIENT_ID and GMAIL_GOOGLE_CLIENT_SECRET environment variables.
|
||||
"""
|
||||
if env("GOOGLE_CLIENT_ID") and env("GOOGLE_CLIENT_SECRET"):
|
||||
if env("GMAIL_GOOGLE_CLIENT_ID") and env("GMAIL_GOOGLE_CLIENT_SECRET"):
|
||||
return cls(api_task_id).get_tools()
|
||||
else:
|
||||
return []
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ class ConfigInfo:
|
|||
"env_vars": [],
|
||||
"toolkit": "google_drive_mcp_toolkit",
|
||||
},
|
||||
ConfigGroup.GOOGLE_GMAIL_MCP.value: {
|
||||
"env_vars": ["GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET", "GOOGLE_REFRESH_TOKEN"],
|
||||
ConfigGroup.GOOGLE_GMAIL.value: {
|
||||
"env_vars": ["GMAIL_GOOGLE_CLIENT_ID", "GMAIL_GOOGLE_CLIENT_SECRET", "GMAIL_GOOGLE_REFRESH_TOKEN"],
|
||||
"toolkit": "google_gmail_native_toolkit",
|
||||
},
|
||||
ConfigGroup.IMAGE_ANALYSIS.value: {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class ConfigGroup(str, Enum):
|
|||
GITHUB = "Github"
|
||||
GOOGLE_CALENDAR = "Google Calendar"
|
||||
GOOGLE_DRIVE_MCP = "Google Drive MCP"
|
||||
GOOGLE_GMAIL_MCP = "Google Gmail MCP"
|
||||
GOOGLE_GMAIL = "Google Gmail"
|
||||
IMAGE_ANALYSIS = "Image Analysis"
|
||||
MCP_SEARCH = "MCP Search"
|
||||
PPTX = "PPTX"
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ const ToolSelect = forwardRef<
|
|||
}
|
||||
};
|
||||
|
||||
} else if (key.toLowerCase() === 'google gmail mcp') {
|
||||
} else if (key.toLowerCase() === 'google gmail') {
|
||||
onInstall = async () => {
|
||||
try {
|
||||
const response = await fetchPost("/install/tool/google_gmail");
|
||||
|
|
@ -172,14 +172,14 @@ const ToolSelect = forwardRef<
|
|||
const existingConfigs = await proxyFetchGet("/api/configs");
|
||||
const existing = Array.isArray(existingConfigs)
|
||||
? existingConfigs.find((c: any) =>
|
||||
c.config_group?.toLowerCase() === "google gmail mcp" &&
|
||||
c.config_name === "GOOGLE_REFRESH_TOKEN"
|
||||
c.config_group?.toLowerCase() === "google gmail" &&
|
||||
c.config_name === "GMAIL_GOOGLE_REFRESH_TOKEN"
|
||||
)
|
||||
: null;
|
||||
|
||||
const configPayload = {
|
||||
config_group: "Google Gmail MCP", //According to backend config
|
||||
config_name: "GOOGLE_REFRESH_TOKEN",
|
||||
config_group: "Google Gmail", //According to backend config
|
||||
config_name: "GMAIL_GOOGLE_REFRESH_TOKEN",
|
||||
config_value: "exists",
|
||||
};
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ const ToolSelect = forwardRef<
|
|||
? t("layout.notion-workspace-integration")
|
||||
: key.toLowerCase() === 'google calendar'
|
||||
? t("layout.google-calendar-integration")
|
||||
: key.toLowerCase() === 'google gmail mcp'
|
||||
: key.toLowerCase() === 'google gmail'
|
||||
? "Google Gmail integration for managing emails and contacts"
|
||||
: "",
|
||||
onInstall,
|
||||
|
|
@ -517,7 +517,7 @@ const ToolSelect = forwardRef<
|
|||
}
|
||||
|
||||
// Trigger instantiation for Gmail
|
||||
if (activeMcp.key === "Google Gmail MCP") {
|
||||
if (activeMcp.key === "Google Gmail") {
|
||||
console.log("[ToolSelect installMcp] Starting Gmail installation");
|
||||
try {
|
||||
const response = await fetchPost("/install/tool/google_gmail");
|
||||
|
|
@ -528,14 +528,14 @@ const ToolSelect = forwardRef<
|
|||
const existingConfigs = await proxyFetchGet("/api/configs");
|
||||
const existing = Array.isArray(existingConfigs)
|
||||
? existingConfigs.find((c: any) =>
|
||||
c.config_group?.toLowerCase() === "google gmail mcp" &&
|
||||
c.config_name === "GOOGLE_REFRESH_TOKEN"
|
||||
c.config_group?.toLowerCase() === "google gmail" &&
|
||||
c.config_name === "GMAIL_GOOGLE_REFRESH_TOKEN"
|
||||
)
|
||||
: null;
|
||||
|
||||
const configPayload = {
|
||||
config_group: "Google Gmail MCP",
|
||||
config_name: "GOOGLE_REFRESH_TOKEN",
|
||||
config_group: "Google Gmail",
|
||||
config_name: "GMAIL_GOOGLE_REFRESH_TOKEN",
|
||||
config_value: "exists",
|
||||
};
|
||||
|
||||
|
|
@ -580,14 +580,14 @@ const ToolSelect = forwardRef<
|
|||
const existingConfigs = await proxyFetchGet("/api/configs");
|
||||
const existing = Array.isArray(existingConfigs)
|
||||
? existingConfigs.find((c: any) =>
|
||||
c.config_group?.toLowerCase() === "google gmail mcp" &&
|
||||
c.config_name === "GOOGLE_REFRESH_TOKEN"
|
||||
c.config_group?.toLowerCase() === "google gmail" &&
|
||||
c.config_name === "GMAIL_GOOGLE_REFRESH_TOKEN"
|
||||
)
|
||||
: null;
|
||||
|
||||
const configPayload = {
|
||||
config_group: "Google Gmail MCP",
|
||||
config_name: "GOOGLE_REFRESH_TOKEN",
|
||||
config_group: "Google Gmail",
|
||||
config_name: "GMAIL_GOOGLE_REFRESH_TOKEN",
|
||||
config_value: "exists",
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export function AddWorker({
|
|||
?.replace(/}}/g, "") || "",
|
||||
};
|
||||
// GOOGLE_REFRESH_TOKEN is obtained via OAuth and does not require manual input
|
||||
if (key === "GOOGLE_REFRESH_TOKEN") {
|
||||
if (key === "GOOGLE_REFRESH_TOKEN" || key === "GMAIL_GOOGLE_REFRESH_TOKEN") {
|
||||
initialValues[key].required = false;
|
||||
}
|
||||
initialVisibility[key] = false;
|
||||
|
|
@ -164,7 +164,7 @@ export function AddWorker({
|
|||
// call ToolSelect's install method
|
||||
if (toolSelectRef.current) {
|
||||
try {
|
||||
if (activeMcp.key === "EXA Search" || activeMcp.key === "Google Calendar" || activeMcp.key === "Google Gmail MCP") {
|
||||
if (activeMcp.key === "EXA Search" || activeMcp.key === "Google Calendar" || activeMcp.key === "Google Gmail") {
|
||||
await toolSelectRef.current.installMcp(
|
||||
activeMcp.id,
|
||||
{ ...envValues },
|
||||
|
|
@ -179,7 +179,7 @@ export function AddWorker({
|
|||
}
|
||||
|
||||
// For Google Calendar, close dialog after installMcp completes
|
||||
if (activeMcp.key === "Google Calendar" || activeMcp.key === "Google Gmail MCP") {
|
||||
if (activeMcp.key === "Google Calendar" || activeMcp.key === "Google Gmail") {
|
||||
setShowEnvConfig(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export default function IntegrationList({
|
|||
return;
|
||||
}
|
||||
|
||||
if (item.key === "Google Gmail MCP") {
|
||||
if (item.key === "Google Gmail") {
|
||||
const mcp = createMcpFromItem(item, 15);
|
||||
if (isSelectMode) {
|
||||
onShowEnvConfig?.(mcp);
|
||||
|
|
@ -210,13 +210,13 @@ export default function IntegrationList({
|
|||
console.log("[IntegrationList onConnect] Polling timeout");
|
||||
return;
|
||||
}
|
||||
} else if (mcp.key === "Google Gmail MCP") {
|
||||
} else if (mcp.key === "Google Gmail") {
|
||||
console.log(
|
||||
"[IntegrationList onConnect] Google Gmail detected, starting auth flow"
|
||||
);
|
||||
|
||||
// Trigger install/authorization
|
||||
const gmailItem = items.find((item) => item.key === "Google Gmail MCP");
|
||||
const gmailItem = items.find((item) => item.key === "Google Gmail");
|
||||
try {
|
||||
if (gmailItem && gmailItem.onInstall) {
|
||||
await gmailItem.onInstall();
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ export function useIntegrationManagement(items: IntegrationItem[]) {
|
|||
const map: { [key: string]: boolean } = {};
|
||||
|
||||
items.forEach((item) => {
|
||||
if (item.key === "Google Calendar" || item.key === "Google Gmail MCP") {
|
||||
if (item.key === "Google Calendar" || item.key === "Google Gmail") {
|
||||
// Only mark installed when refresh token is present (auth completed)
|
||||
const hasRefreshToken = configs.some(
|
||||
(c: any) =>
|
||||
c.config_group?.toLowerCase() === item.key.toLowerCase() &&
|
||||
c.config_name === "GOOGLE_REFRESH_TOKEN" &&
|
||||
["GOOGLE_REFRESH_TOKEN", "GMAIL_GOOGLE_REFRESH_TOKEN"].includes(c.config_name) &&
|
||||
c.config_value && String(c.config_value).length > 0
|
||||
);
|
||||
map[item.key] = hasRefreshToken;
|
||||
|
|
@ -248,7 +248,7 @@ export function useIntegrationManagement(items: IntegrationItem[]) {
|
|||
} catch (e) {
|
||||
console.log("Failed to clean up Google Calendar tokens:", e);
|
||||
}
|
||||
} else if (item.key === "Google Gmail MCP") {
|
||||
} else if (item.key === "Google Gmail") {
|
||||
try {
|
||||
await fetchDelete("/uninstall/tool/google_gmail");
|
||||
console.log("Cleaned up Google Gmail authentication tokens");
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ export default function SettingMCP() {
|
|||
);
|
||||
}
|
||||
}
|
||||
} else if (key.toLowerCase() === 'google gmail mcp') {
|
||||
} else if (key.toLowerCase() === 'google gmail') {
|
||||
onInstall = async () => {
|
||||
try {
|
||||
const response = await fetchPost("/install/tool/google_gmail");
|
||||
|
|
@ -320,14 +320,14 @@ export default function SettingMCP() {
|
|||
const existingConfigs = await proxyFetchGet("/api/configs");
|
||||
const existing = Array.isArray(existingConfigs)
|
||||
? existingConfigs.find((c: any) =>
|
||||
c.config_group?.toLowerCase() === "google gmail mcp" &&
|
||||
c.config_name === "GOOGLE_REFRESH_TOKEN"
|
||||
c.config_group?.toLowerCase() === "google gmail" &&
|
||||
c.config_name === "GMAIL_GOOGLE_REFRESH_TOKEN"
|
||||
)
|
||||
: null;
|
||||
|
||||
const configPayload = {
|
||||
config_group: "Google Gmail MCP",
|
||||
config_name: "GOOGLE_REFRESH_TOKEN",
|
||||
config_group: "Google Gmail",
|
||||
config_name: "GMAIL_GOOGLE_REFRESH_TOKEN",
|
||||
config_value: "exists",
|
||||
};
|
||||
|
||||
|
|
@ -358,14 +358,14 @@ export default function SettingMCP() {
|
|||
const configs = await proxyFetchGet("/api/configs");
|
||||
const existing = Array.isArray(configs)
|
||||
? configs.find((c: any) =>
|
||||
c.config_group?.toLowerCase() === "google gmail mcp" &&
|
||||
c.config_name === "GOOGLE_REFRESH_TOKEN"
|
||||
c.config_group?.toLowerCase() === "google gmail" &&
|
||||
c.config_name === "GMAIL_GOOGLE_REFRESH_TOKEN"
|
||||
)
|
||||
: null;
|
||||
|
||||
const payload = {
|
||||
config_group: "Google Gmail MCP",
|
||||
config_name: "GOOGLE_REFRESH_TOKEN",
|
||||
config_group: "Google Gmail",
|
||||
config_name: "GMAIL_GOOGLE_REFRESH_TOKEN",
|
||||
config_value: "exists",
|
||||
};
|
||||
|
||||
|
|
@ -420,7 +420,7 @@ export default function SettingMCP() {
|
|||
? t("setting.notion-workspace-integration")
|
||||
: key.toLowerCase() === "google calendar"
|
||||
? t("setting.google-calendar-integration")
|
||||
: key.toLowerCase() === 'google gmail mcp'
|
||||
: key.toLowerCase() === 'google gmail'
|
||||
? "Google Gmail integration for managing emails, drafts, and contacts"
|
||||
: "",
|
||||
onInstall,
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ export const MCPEnvDialog: FC<MCPEnvDialogProps> = ({
|
|||
if (key === 'EXA_API_KEY') {
|
||||
initialValues[key].required = false;
|
||||
}
|
||||
if (key === 'GOOGLE_REFRESH_TOKEN') {
|
||||
if (key === 'GOOGLE_REFRESH_TOKEN' || key === 'GMAIL_GOOGLE_REFRESH_TOKEN') {
|
||||
initialValues[key].required = false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue