UI Widgets/Configuration

Configuration Guide

Configure authentication and initialize widgets in your application

SDK Configuration Parameters

Both integration modes require the same core configuration parameters for authentication and initialization.

Parameter Type Required Description
email string Yes Currently logged-in user's email from your system
companyId string Yes Company ID provided by Eureka
publicKey string Yes Public key provided by Eureka for RSA encryption
JSEncrypt constructor Yes Global JSEncrypt constructor from the library
iframe HTMLElement iframe only iframe DOM element for embedding mode

New Window Mode Configuration

Configure the SDK to open AI Agents in a new browser window. This mode is ideal for standalone workflows and complex analysis tasks.

JavaScript
const PatsnapAgentNewTab = window.PatsnapAgentSDK.AgentNewTab;
const AGENT_NAME = window.PatsnapAgentSDK.AGENT_NAME;

// Initialize SDK
const agentNewTab = new PatsnapAgentNewTab({
  email: 'user@yourcompany.com',
  companyId: 'your-company-id',
  publicKey: 'YOUR_PUBLIC_KEY',
  JSEncrypt: window.JSEncrypt,
});

// Login and open agent
document.getElementById('btn').addEventListener('click', async () => {
  try {
    await agentNewTab.login();
    await agentNewTab.openAgent(AGENT_NAME.NOVELTY_SEARCH);
  } catch (error) {
    console.error('Failed to open agent:', error);
  }
});

iframe Embedding Mode Configuration

Configure the SDK to embed AI Agents directly into your page. This mode provides seamless integration within your existing UI.

HTML
<iframe id="agent-iframe" style="width: 100%; height: 600px; border: none;"></iframe>
JavaScript
const AgentIframe = window.PatsnapAgentSDK.AgentIframe;
const AGENT_NAME = window.PatsnapAgentSDK.AGENT_NAME;

const iframe = document.getElementById('agent-iframe');

// Initialize SDK
const agentIframe = new AgentIframe({
  email: 'user@yourcompany.com',
  companyId: 'your-company-id',
  publicKey: 'YOUR_PUBLIC_KEY',
  JSEncrypt: window.JSEncrypt,
  iframe: iframe,
});

// Login and initialize agent
document.getElementById('btn').addEventListener('click', async () => {
  try {
    await agentIframe.login();
    await agentIframe.init(AGENT_NAME.NOVELTY_SEARCH);
  } catch (error) {
    console.error('Failed to initialize agent:', error);
  }
});

Important: iframe mode requires CSP (Content Security Policy) configuration. Add Eureka domains to your whitelist, or use new window mode if CSP configuration is not possible.

Advanced Configuration

Customize widget behavior with advanced configuration options for export handling and question pre-filling.

Export Configuration

Control how AI Agents handle report exports. Available for Patent Disclosure agent only.

const EXPORT_BEHAVIOR = window.PatsnapAgentSDK.EXPORT_BEHAVIOR;

await agentNewTab.openAgent(AGENT_NAME.PATENT_DISCLOSURE, {
  exportConfig: {
    behavior: EXPORT_BEHAVIOR.EVENT_ONLY,
  },
  eventListeners: {
    exportReport: (eventData) => {
      console.log('Export task ID:', eventData.taskId);
      // Use taskId to call OpenAPI endpoint for report download
    }
  }
});

Question Configuration

Pre-fill questions when opening an agent to streamline user workflows.

await agentNewTab.openAgent(AGENT_NAME.TECHNICAL_QA, {
  questionConfig: {
    input: 'Explain machine learning overfitting',
    enableInputAppendToJob: true  // Use as initial question
  }
});

Available Agents

Access 30+ AI Agent widgets across multiple domains. Use the AGENT_NAME constants to specify which agent to open.

Research & Innovation

RESEARCHTECHNICAL_QAFIND_SOLUTIONNOVELTY_CHECKCOMPANY_SEARCH

Intellectual Property

NOVELTY_SEARCHPATENT_DISCLOSURESEMANTIC_SEARCHFTO_PRO

Life Sciences & Materials

LS_PIAMATERIAL_TECHNICAL_QAMATERIAL_SCOUT

See the complete list of available agents and their capabilities in the API Reference section of the agent integration documentation.

Next Steps

Configuration complete! Check the FAQ section for common issues and troubleshooting tips, or start integrating widgets into your application.