1.2.23 • Published 5 months ago

@infinilabs/search-chat v1.2.23

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

SearchChat Web Component API

A customizable search and chat interface component for web applications.

Installation

npm install @infini/coco-app

Basic Usage

import SearchChat from '@infini/coco-app';

function App() {
  return (
    <SearchChat 
      serverUrl="https://your-server.com"
      headers={{
        "X-API-TOKEN": "your-token",
        "APP-INTEGRATION-ID": "your-app-id"
      }}
    />
  );
}

Props

width

  • Type: number
  • Default: 680
  • Description: Maximum width of the component in pixels

height

  • Type: number
  • Default: 590
  • Description: Height of the component in pixels

headers

  • Type: Record<string, unknown>
  • Default:
{
  "X-API-TOKEN": "default-token",
  "APP-INTEGRATION-ID": "default-id"
}
  • Description: HTTP headers for API requests

serverUrl

  • Type: string
  • Default: ""
  • Description: Base URL for the server API

hasModules

  • Type: string[]
  • Default: ["search", "chat"]
  • Description: Available modules to show

defaultModule

  • Type: "search" | "chat"
  • Default: "search"
  • Description: Initial active module

assistantIDs

  • Type: string[]
  • Default: []
  • Description: List of assistant IDs to use

theme

  • Type: "auto" | "light" | "dark"
  • Default: "dark"
  • Description: UI theme setting

searchPlaceholder

  • Type: string
  • Default: ""
  • Description: Placeholder text for search input

chatPlaceholder

  • Type: string
  • Default: ""
  • Description: Placeholder text for chat input

showChatHistory

  • Type: boolean
  • Default: false
  • Description: Whether to display chat history panel

startPage

  • Type: StartPage
  • Optional: Yes
  • Description: Initial page configuration

setIsPinned

  • Type: (value: boolean) => void
  • Optional: Yes
  • Description: Callback when pin status changes

onCancel

  • Type: () => void
  • Optional: Yes
  • Description: Callback when close button is clicked (mobile only)

isOpen

  • Type: boolean
  • Optional: Yes
  • Description: Control component visibility

Events

The component emits the following events:

  • onModeChange: Triggered when switching between search and chat modes
  • onCancel: Triggered when the close button is clicked (mobile only)

Mobile Support

The component is responsive and includes mobile-specific features:

  • Automatic height adjustment
  • Close button in top-right corner
  • Touch-friendly interface

Example

<SearchChat
  width={800}
  height={600}
  serverUrl="https://api.example.com"
  headers={{
    "X-API-TOKEN": "your-token",
    "APP-INTEGRATION-ID": "your-app-id"
  }}
  theme="dark"
  showChatHistory={true}
  hasModules={["search", "chat"]}
  defaultModule="chat"
  setIsPinned={(isPinned) => console.log('Pinned:', isPinned)}
/>
1.2.23

5 months ago

1.2.22

5 months ago

1.2.21

5 months ago

1.2.20

5 months ago

1.2.19

5 months ago

1.2.18

5 months ago

1.2.17

5 months ago

1.2.16

5 months ago

1.2.15

5 months ago

1.2.14

5 months ago

1.2.13

5 months ago

1.12.11

5 months ago

1.2.12

5 months ago

1.2.11

5 months ago

1.2.10

5 months ago

1.2.9

5 months ago

1.2.8

5 months ago

1.2.7

5 months ago

1.2.6

5 months ago

1.2.5

5 months ago

1.2.4

5 months ago

1.2.3

5 months ago

1.2.2

5 months ago

1.2.1

5 months ago

1.2.0

5 months ago

1.1.17

6 months ago

1.1.16

6 months ago

1.1.15

6 months ago

1.1.14

6 months ago

1.1.13

6 months ago

1.1.12

6 months ago

1.1.11

6 months ago

1.1.10

6 months ago

1.1.9

6 months ago

1.1.8

6 months ago

1.1.7

6 months ago

1.1.6

6 months ago

1.1.5

6 months ago

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.10

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago