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
5 changes: 5 additions & 0 deletions .changeset/forty-ducks-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@inkeep/agents-manage-ui": patch
---

warn once `PUBLIC_INKEEP_COPILOT_AGENT_ID, PUBLIC_INKEEP_COPILOT_PROJECT_ID, PUBLIC_INKEEP_COPILOT_TENANT_ID are not set, copilot chat will not be displayed`
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useOAuthLogin } from '@/hooks/use-oauth-login';
import { generateId } from '@/lib/utils/id-utils';
import { useCopilotContext } from './copilot-context';
import { IkpMessage } from './message-parts/message';
import { warnOnce } from '@/lib/warn-once';

interface CopilotChatProps {
agentId?: string;
Expand Down Expand Up @@ -79,7 +80,7 @@ export function CopilotChat({ agentId, tenantId, projectId, refreshAgentGraph }:
!PUBLIC_INKEEP_COPILOT_PROJECT_ID ||
!PUBLIC_INKEEP_COPILOT_TENANT_ID
) {
console.error(
warnOnce(
'PUBLIC_INKEEP_COPILOT_AGENT_ID, PUBLIC_INKEEP_COPILOT_PROJECT_ID, PUBLIC_INKEEP_COPILOT_TENANT_ID are not set, copilot chat will not be displayed'
);
return null;
Expand Down
13 changes: 13 additions & 0 deletions agents-manage-ui/src/lib/warn-once.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function createWarnOnce() {
const messages = new Set<string>();

return (message: string): void => {
if (messages.has(message)) {
return;
}
messages.add(message);
console.warn(message);
};
}

export const warnOnce = createWarnOnce();
Loading