Skip to content

Commit 9fee0bd

Browse files
committed
enhance: append manual gmail config to response
1 parent 7c72119 commit 9fee0bd

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

src/components/AddWorker/ToolSelect.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { getProxyBaseURL } from "@/lib";
1717
import { capitalizeFirstLetter } from "@/lib";
1818
import { useAuthStore } from "@/store/authStore";
1919
import { useTranslation } from "react-i18next";
20+
import { GMAIL_CONFIG } from "@/pages/Setting/MCP";
2021
interface McpItem {
2122
id: number;
2223
name: string;
@@ -56,6 +57,10 @@ const ToolSelect = forwardRef<
5657
proxyFetchGet("/api/config/info").then((res) => {
5758
if (res && typeof res === "object") {
5859
const baseURL = getProxyBaseURL();
60+
if (typeof res === "object" && res !== null) {
61+
Object.assign(res, GMAIL_CONFIG);
62+
console.log("Modified config info with Gmail:", res);
63+
}
5964

6065
const list = Object.entries(res)
6166
.filter(([key]) => {

src/pages/Setting/API.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Input } from "@/components/ui/input";
33
import { Circle } from "lucide-react";
44
import { useEffect, useState } from "react";
55
import { proxyFetchGet, proxyFetchPost } from "@/api/http";
6+
import { GMAIL_CONFIG } from "./MCP";
67

78
interface ConfigItem {
89
name: string;
@@ -16,7 +17,11 @@ export default function SettingAPI() {
1617
const [errors, setErrors] = useState<Record<string, string>>({});
1718

1819
useEffect(() => {
19-
proxyFetchGet("/api/config/info").then((res) => {
20+
proxyFetchGet("/api/config/info").then((res) => {
21+
if (typeof res === "object" && res !== null) {
22+
Object.assign(res, GMAIL_CONFIG);
23+
console.log("Modified config info with Gmail:", res);
24+
}
2025
const configs = Object.entries(res || {})
2126
.map(([name, v]: [string, any]) => ({ name, env_vars: v.env_vars }))
2227
.filter((item) => Array.isArray(item.env_vars) && item.env_vars.length > 0);

src/pages/Setting/MCP.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ import { useTranslation } from "react-i18next";
2424
import { toast } from "sonner";
2525
import { ConfigFile } from "electron/main/utils/mcpConfig";
2626

27+
export const GMAIL_CONFIG = {
28+
"Google Gmail": {
29+
"env_vars": [
30+
"GOOGLE_CLIENT_ID",
31+
"GOOGLE_CLIENT_SECRET",
32+
"GOOGLE_REFRESH_TOKEN"
33+
],
34+
"toolkit": "google_gmail_mcp_toolkit"
35+
}
36+
}
37+
2738
export default function SettingMCP() {
2839
const navigate = useNavigate();
2940
const { checkAgentTool } = useAuthStore();
@@ -109,6 +120,11 @@ export default function SettingMCP() {
109120
useEffect(() => {
110121
proxyFetchGet("/api/config/info").then((res) => {
111122
if (res && typeof res === "object") {
123+
if (typeof res === "object" && res !== null) {
124+
Object.assign(res, GMAIL_CONFIG);
125+
console.log("Modified config info with Gmail:", res);
126+
}
127+
112128
const baseURL = getProxyBaseURL();
113129
const list = Object.entries(res).map(([key, value]: [string, any]) => {
114130
let onInstall = null;

0 commit comments

Comments
 (0)