Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If you're new, you should probably head over to [gooey.ai/copilot](https://gooey
<script>
GooeyEmbed.mount({
target: "#gooey-embed",
integration_id: "Kbo", // Your Integration ID
deployment_id: "Kbo", // Your Deployment ID
});
</script>
```
Expand All @@ -27,7 +27,7 @@ If you use the lib.js provided from gooey.ai, the config will be automatically p
<script src="https://gooey.ai/chat/<Name>-<Integration ID>/lib.js"></script>
```

2. Replace `"Kbo"` with your Integration's ID, as it appears on the Copilot's Integration tab.
2. Replace `"Kbo"` with your Deployment ID, as it appears on the Copilot's Deploy tab. (Note: `integration_id` is still supported for backwards compatibility but is deprecated.)

## Configuration Options

Expand All @@ -36,12 +36,15 @@ If you use the lib.js provided from gooey.ai, the config will be automatically p
```js
const config = {
target: "#gooey-embed",
integration_id: "Kbo",
deployment_id: "Kbo",
mode: "popup" | "inline" | "fullscreen",
enableAudioMessage: true,
showSources: true,
enablePhotoUpload: true,
enableConversations: true,
secrets: {
GOOGLE_MAPS_API_KEY: "your-google-maps-api-key-here",
},
Comment on lines +45 to +47
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove duplicate secrets configuration.

The secrets configuration block appears twice in the example (lines 45-47 and again at lines 65-67). This duplication could confuse users.

Apply this diff to remove the duplicate:

   branding: {
     name: "Farmer.CHAT",
     byLine: "By Digital Green",
     description:
       "An AI Assistant designed to help farmer extension agents in India.",
     conversationStarters: [
       "When should I plant chili?",
       "How can I get rid of black ants on my coffee?",
       "What is the best time to grow pepper in India?",
     ],
     fabLabel: "Help",
     photoUrl:
       "https://digitalgreen.org/wp-content/themes/digital-green/images/favicons/apple-touch-icon.png",
     websiteUrl: "https://digitalgreen.org/",
     showPoweredByGooey: true,
     color: { primary: "purple", "secondary": "blue" },
   },
-  secrets: {
-    GOOGLE_MAPS_API_KEY: "your-google-maps-api-key-here",
-  },
   payload: {
     user_id: "123",
     variables: {
       product_id: "sample_id",
       product_name: "sample_name",
     },
   },

Also applies to: 65-67

🤖 Prompt for AI Agents
In README.md around lines 45-47 and again at lines 65-67, the example contains a
duplicated secrets configuration block (GOOGLE_MAPS_API_KEY). Remove the second
duplicate block (lines 65-67) so the secrets section appears only once, and
update any surrounding commas or formatting to keep the YAML/JSON example valid
after removal.

branding: {
name: "Farmer.CHAT",
byLine: "By Digital Green",
Expand Down Expand Up @@ -77,9 +80,11 @@ GooeyEmbed.mount(config);

Specifies the [CSS selector](https://www.w3schools.com/css/css_selectors.asp) of the div where the widget will be embedded.

##### `integration_id: string` **Required**
##### `deployment_id: string` **Required**

The unique identifier for your Gooey Bot Integration. (Note that this is snake_case, to match the Gooey API `payload`)
The unique identifier for your Gooey Bot Deployment. (Note that this is snake_case, to match the Gooey API `payload`)

**Note:** `integration_id` is deprecated but still supported for backwards compatibility. Please use `deployment_id` going forward.

##### `mode: string (popup | inline)`

Expand Down Expand Up @@ -136,13 +141,13 @@ Controls visual aspects of the widget and defines the textual content and relate
- `colors`: An object to set the theme colors for widget ( e.g Colored Links, Buttons etc.)
- `primary`: string
- `secondary`: string
-

##### `secrets: object`

Contains API keys and other sensitive configuration for third-party services.

- `GOOGLE_MAPS_API_KEY`: Optional Google Maps API key that enables location search with autocomplete and interactive Google Maps for location input. If not provided, the widget falls back to OpenStreetMap (free, manual location selection only).

##### `payload: object`

Contains the data sent to the Gooey API.
Expand Down
2 changes: 1 addition & 1 deletion src/api/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const createStreamApi = async (
body: any,
cancelToken: any,
) => {
let url = new URL("/v3/integrations/stream/", apiUrl).toString();
let url = new URL("/v3/deployments/stream/", apiUrl).toString();
const headers = getHeaders();
const finalBody = {
citation_style: "number",
Expand Down
8 changes: 4 additions & 4 deletions src/contexts/MessagesContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const MessagesContextProvider = ({
const { config, layoutController } = useSystemContext();
const { conversations, handleAddConversation } = useConversations(
currentUserId,
config?.integration_id as string,
config?.deployment_id as string,
);

const [messages, setMessages] = useState(new Map());
Expand Down Expand Up @@ -324,7 +324,7 @@ const MessagesContextProvider = ({
user_id: prevMessage?.user_id,
title: payload?.title,
timestamp: payload?.created_at,
bot_id: config?.integration_id,
bot_id: config?.deployment_id
};
updateCurrentConversation(conversationData);
handleAddConversation(
Expand Down Expand Up @@ -363,7 +363,7 @@ const MessagesContextProvider = ({
});
scrollToMessage();
},
[config?.integration_id, handleAddConversation, scrollToMessage],
[config?.deployment_id, handleAddConversation, scrollToMessage],
);

const sendPayload = async (payload: RequestModel) => {
Expand All @@ -378,7 +378,7 @@ const MessagesContextProvider = ({

payload = {
...configPayload,
integration_id: config?.integration_id,
deployment_id: config?.deployment_id,
user_id: currentUserId,
...payload,
};
Expand Down
4 changes: 3 additions & 1 deletion src/contexts/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export interface CopilotConfigType {
target: string;
integration_id: string;
deployment_id: string;
/** @deprecated Use deployment_id instead. This field will be removed in a future version. */
integration_id?: string;
mode: "popup" | "inline" | "fullscreen";
enableAudioMessage: boolean;
enablePhotoUpload: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class GooeyEmbedFactory {
`Target not found: ${config.target}. Please provide a valid "target" selector in the config object.`,
);
}
if (!config.integration_id) {
if (!config.integration_id && !config.deployment_id) {
throw new Error(
`Integration ID is required. Please provide an "integration_id" in the config object.`,
`Deployment ID is required. Please provide an "deployment_id" in the config object.`,
);
}
Comment on lines +21 to 25
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix article in error message.

The validation logic correctly maintains backward compatibility by accepting either integration_id or deployment_id. However, there's a grammatical error in the message.

Apply this diff:

-        `Deployment ID is required. Please provide an "deployment_id" in the config object.`,
+        `Deployment ID is required. Please provide a "deployment_id" in the config object.`,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!config.integration_id && !config.deployment_id) {
throw new Error(
`Integration ID is required. Please provide an "integration_id" in the config object.`,
`Deployment ID is required. Please provide an "deployment_id" in the config object.`,
);
}
if (!config.integration_id && !config.deployment_id) {
throw new Error(
`Deployment ID is required. Please provide a "deployment_id" in the config object.`,
);
}
🤖 Prompt for AI Agents
In src/lib.tsx around lines 21 to 25, the error message uses incorrect article
wording; update the thrown Error text to use proper grammar such as "A
deployment ID is required. Please provide a \"deployment_id\" in the config
object." so the message reads clearly and consistently.


Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const defaultConfig = {
enablePhotoUpload: true,
enableAudioMessage: true,
enableConversations: true,
integration_id: "Kbo",
deployment_id: "Kbo",
};

GooeyEmbed.mount({ target: "#popup", mode: "popup", ...defaultConfig });
Expand Down
3 changes: 3 additions & 0 deletions src/widgets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export function CopilotChatWidget({
enableAudioMessage: true,
showSources: true,
...config,
// Normalize deployment_id: use deployment_id if present,
// otherwise fall back to integration_id for backwards compatibility
deployment_id: config?.deployment_id || config?.integration_id || "",
branding: {
showPoweredByGooey: true,
...config?.branding,
Expand Down
4 changes: 2 additions & 2 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<div id="popup"></div>
<script src="dist/lib.js"></script>
<script>
GooeyEmbed.mount({ target: "#popup", integration_id: "MqL", mode: "popup" });
GooeyEmbed.mount({ target: "#inline", integration_id: "MqL", mode: "inline" });
GooeyEmbed.mount({ target: "#popup", deployment_id: "MqL", mode: "popup" });
GooeyEmbed.mount({ target: "#inline", deployment_id: "MqL", mode: "inline" });
</script>
</body>
</html>