### Install Google Drive API Go Client and OAuth2 Package Source: https://github.com/infinilabs/coco-server/blob/main/plugins/connectors/google_drive/README.md Use these go get commands to install the required Google Drive API client library and the OAuth2.0 package for Go development. ```bash go get google.golang.org/api/drive/v3 go get golang.org/x/oauth2/google ``` -------------------------------- ### Quick Start: Run Coco Server with Docker Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/getting-started/install.md Use this command for the simplest setup. It automatically manages data persistence using Docker volumes and runs the server in detached mode. ```bash docker run -d \ --name cocoserver \ -p 9000:9000 \ -v coco_data_vol:/app/easysearch/data \ -v coco_config_vol:/app/easysearch/config \ -v coco_logs_vol:/app/easysearch/logs \ infinilabs/coco:0.9.0 ``` -------------------------------- ### Advanced Install: Run Coco Server Container Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/getting-started/install.md Start the main Coco Server container, mounting your prepared host directories and using the `.env` file for secure password management. This command includes resource limits and restart policies. ```bash docker run -d \ --name cocoserver \ --hostname coco-server \ --restart unless-stopped \ --env-file /data/cocoserver/.env \ -m 4g --cpus="2" \ -p 9000:9000 \ -v /data/cocoserver/data:/app/easysearch/data \ -v /data/cocoserver/config:/app/easysearch/config \ -v /data/cocoserver/logs:/app/easysearch/logs \ -e ES_JAVA_OPTS="-Xms2g -Xmx2g" \ infinilabs/coco:0.9.0 ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/infinilabs/coco-server/blob/main/web/README.md Installs all necessary project dependencies using pnpm. Ensure Node.js and pnpm are installed and configured. ```bash pnpm i ``` -------------------------------- ### Remove Docker Volumes (Quick Start Cleanup) Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/getting-started/install.md If you used the Quick Start method with Docker Volumes, use this command to remove the associated data, config, and logs volumes during cleanup. ```bash docker volume rm data config logs ``` -------------------------------- ### Get System Settings Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/system/settings.md Retrieves the current system settings. This includes server name, endpoint, provider details, chat start page configuration, and search settings. ```APIDOC ## Get System Settings ### Description Retrieves the current system settings. This includes server name, endpoint, provider details, chat start page configuration, and search settings. ### Method GET ### Endpoint /settings ### Request Example ```shell curl -XGET http://localhost:9000/settings \ -H "Authorization: Bearer " ``` ### Response #### Success Response (200) - **server** (object) - Server configuration details. - **app_settings** (object) - Application specific settings. - **search_settings** (object) - Search module configuration. #### Response Example ```json { "server": { "name": "My Coco Server", "endpoint": "http://localhost:9000", "provider": { "name": "INFINI Labs", "icon": "http://localhost:9000/icon.png", "website": "http://infinilabs.com", "banner": "http://localhost:9000/banner.jpg", "description": "Coco AI Server - Search, Connect, Collaborate, AI-powered enterprise search, all in one space." } }, "app_settings": { "chat": { "chat_start_page": { "enabled": true, "logo": { "light": "", "dark": "" }, "introduction": "Welcome to Coco AI", "display_assistants": [] } } }, "search_settings": { "enabled": true, "integration": "" } } ``` ``` -------------------------------- ### Start Coco AI Server with Environment Variables Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/getting-started/install.md This command starts the Coco AI server using a local script. It sets environment variables for the Ollama model and Easysearch password, and displays the server's startup information. ```bash $ OLLAMA_MODEL=deepseek-r1:1.5b ES_PASSWORD=45ff432a5428ade77c7b ./bin/coco ___ ___ ___ ___ _ _____ / __\/___\/ __\/___\ /_\ \_ \ / / // // / // // //_\ / /\/ / /__/ \_// /__/ \_// / _ \/\/_/_ \____|___/\____|___/ \_/ \_/\____/ [COCO] Coco AI - search, connect, collaborate – all in one place. [COCO] 1.0.0_SNAPSHOT#001, 2024-10-23 08:37:05, 2025-12-31 10:10:10, 9b54198e04e905406db90d145f4c01fca0139861 [10-23 17:17:36] [INF] [env.go:179] configuration auto reload enabled [10-23 17:17:36] [INF] [env.go:185] watching config: /Users/medcl/go/src/infini.sh/coco/config [10-23 17:17:36] [INF] [app.go:285] initializing coco, pid: 13764 [10-23 17:17:36] [INF] [app.go:286] using config: /Users/medcl/go/src/infini.sh/coco/coco.yml [10-23 17:17:36] [INF] [api.go:196] local ips: 192.168.3.10 [10-23 17:17:36] [INF] [api.go:360] api listen at: http://0.0.0.0:2900 [10-23 17:17:36] [INF] [module.go:136] started module: api [10-23 17:17:36] [INF] [module.go:155] started plugin: statsd [10-23 17:17:36] [INF] [module.go:161] all modules are started [10-23 17:17:36] [INF] [instance.go:78] workspace: /Users/medcl/go/src/infini.sh/coco/data/coco/nodes/csai3njq50k2c4tcb4vg [10-23 17:17:36] [INF] [app.go:511] coco is up and running now. ``` -------------------------------- ### Configure Jira Data Center/Server Datasource Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/connectors/jira.md Example configuration for a self-hosted Jira Data Center or Server datasource using a Personal Access Token (PAT). This example also enables indexing of comments and attachments. ```shell curl -H 'Content-Type: application/json' -XPOST "http://localhost:9000/datasource/" -d '{ "name": "My Self-Hosted Jira", "type": "connector", "enabled": true, "connector": { "id": "jira", "config": { "endpoint": "https://jira.your-domain.com", "token": "your-personal-access-token", "project_key": "PROJ", "index_comments": true, "index_attachments": true } }, "sync": { "enabled": true, "interval": "10m" } }' ``` -------------------------------- ### Start Development Server Source: https://github.com/infinilabs/coco-server/blob/main/web/README.md Launches the Vite development server with hot-reloading enabled for rapid UI development. Ensure backend connection is configured. ```bash pnpm dev ``` -------------------------------- ### Search Documents Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/document.md Perform a search query against the document index. This example shows a basic GET request without specific query parameters, which may return a default set of results. The response includes the total number of hits and a list of matching documents with their IDs and source information. ```shell //request curl -XGET http://localhost:9000/document/_search //response { "took": 5, "hits": { "total": { "value": 10, "relation": "eq" }, "hits": [ { "_id": "cso9vr3q50k38nobvmcg", "_source": { "id": "cso9vr3q50k38nobvmcg", "title": "Q3 Business Report", "category": "report", "created": "2024-11-10T19:58:36.009086+08:00", "updated": "2024-11-10T19:58:36.009092+08:00" } } ] } } ``` -------------------------------- ### Advanced Install: Create Directories and Environment File Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/getting-started/install.md Prepare host directories for data, logs, and configuration. Create a `.env` file to securely store the initial admin password. ```bash # Create the parent directory for all Coco Server files. # We recommend using a standard location like /data/cocoserver. sudo mkdir -p /data/cocoserver/{data,logs,config} # Create an environment file to store your password securely. # Replace EASYSEARCH_INITIAL_ADMIN_PASSWORD value with a strong, secret password. echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=$(tr -dc 'A-Za-z0-9_.@+=-' < /dev/urandom | head -c 20)" | sudo tee /data/cocoserver/.env > /dev/null ``` -------------------------------- ### Get System Settings Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/system/settings.md Use this command to retrieve the current system settings. Requires an access token for authorization. ```shell curl -XGET http://localhost:9000/settings \ -H "Authorization: Bearer " ``` ```json { "server": { "name": "My Coco Server", "endpoint": "http://localhost:9000", "provider": { "name": "INFINI Labs", "icon": "http://localhost:9000/icon.png", "website": "http://infinilabs.com", "banner": "http://localhost:9000/banner.jpg", "description": "Coco AI Server - Search, Connect, Collaborate, AI-powered enterprise search, all in one space." } }, "app_settings": { "chat": { "chat_start_page": { "enabled": true, "logo": { "light": "", "dark": "" }, "introduction": "Welcome to Coco AI", "display_assistants": [] } } }, "search_settings": { "enabled": true, "integration": "" } } ``` -------------------------------- ### Get Integration Configuration Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieves the configuration details for a specific integration. ```APIDOC ## GET /integration/{id} ### Description Retrieves the detailed configuration of a specific integration. ### Method GET ### Endpoint /integration/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the integration. ### Request Example ```bash curl -XGET http://localhost:9000/integration/cvj9s15ath21fvf9st00 \ -H "X-API-TOKEN: " ``` ``` -------------------------------- ### Get Content Recommendations Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/search.md Fetch recommended content based on configured profiles. A specific profile can be targeted using its tag. ```shell curl -XGET http://localhost:9000/query/_recommend ``` ```json { "recommendations": [ { "title": "Getting Started Guide", "description": "Learn how to set up and use Coco Server", "score": 1.0, "icon": "book", "url": "https://docs.infinilabs.com/coco-server/main/", "category": "documentation", "breadcrumbs": [ { "icon": "home", "name": "Docs", "url": "https://docs.infinilabs.com/" } ] } ], "total": 1 } ``` ```shell curl -XGET http://localhost:9000/query/_recommend/hot ``` -------------------------------- ### Get a Document Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieve a specific document by its ID. Requires an API token for authentication. ```shell curl -XGET http://localhost:9000/document/cso9vr3q50k38nobvmcg \ -H "X-API-TOKEN: " ``` -------------------------------- ### Get System Settings Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieves the current system settings, including server name, endpoint, provider branding, and application-level settings. Requires authentication. ```shell # GET current settings curl -XGET http://localhost:9000/settings \ -H "Authorization: Bearer " # Response: # { # "server": { # "name": "My Coco Server", # "endpoint": "http://localhost:9000", # "provider": { # "name": "INFINI Labs", # "website": "http://infinilabs.com", # "description": "Coco AI Server" # } # }, # "app_settings": { # "chat": { # "chat_start_page": { "enabled": true, "introduction": "Welcome to Coco AI" } # } # }, # "search_settings": { "enabled": true } # } ``` -------------------------------- ### Get a document Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieves a specific document by its unique identifier. ```APIDOC ## GET /document/{id} ### Description Retrieves a specific document by its unique identifier. ### Method GET ### Endpoint /document/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the document to retrieve. #### Headers - **X-API-TOKEN** (string) - Required - API token for authentication. ### Response #### Success Response (200) - Returns the document object if found. ### Request Example ```shell curl -XGET http://localhost:9000/document/cso9vr3q50k38nobvmcg \ -H "X-API-TOKEN: " ``` ``` -------------------------------- ### Get Integration Configuration using cURL Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieve the configuration details for a specific integration using its ID. ```shell curl -XGET http://localhost:9000/integration/cvj9s15ath21fvf9st00 \ -H "X-API-TOKEN: " ``` -------------------------------- ### Get default recommendations Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieves curated content recommendations based on the default recommendation profile. ```APIDOC ## GET /query/_recommend ### Description Retrieves curated content recommendations based on the default recommendation profile. ### Method GET ### Endpoint /query/_recommend ### Parameters #### Headers - **X-API-TOKEN** (string) - Required - API token for authentication. ### Response #### Success Response (200) - **recommendations** (array) - A list of recommended content items. - **title** (string) - The title of the recommended item. - **score** (number) - The relevance score. - **icon** (string) - An icon representing the item type. - **url** (string) - A URL to the recommended item. - **category** (string) - The category of the recommended item. - **total** (integer) - The total number of recommendations. ### Request Example ```shell curl -XGET http://localhost:9000/query/_recommend \ -H "X-API-TOKEN: " ``` #### Response Example ```json { "recommendations": [ { "title": "Getting Started Guide", "score": 1.0, "icon": "book", "url": "https://docs.infinilabs.com/coco-server/main/", "category": "documentation" } ], "total": 1 } ``` ``` -------------------------------- ### Get Chat Session History Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieves the complete message history for a chat session. ```APIDOC ## GET /chat/{session_id}/_history ### Description Retrieves the full message history of a given chat session. ### Method GET ### Endpoint /chat/{session_id}/_history ### Parameters #### Path Parameters - **session_id** (string) - Required - The ID of the chat session. ### Request Example ```shell curl -XGET http://localhost:9000/chat/d1iah7f3edbmq3jakcs0/_history \ -H "X-API-TOKEN: " ``` ``` -------------------------------- ### Get Default Recommendations Source: https://context7.com/infinilabs/coco-server/llms.txt Fetch curated content recommendations based on the default recommendation profile. Requires an API token. ```shell curl -XGET http://localhost:9000/query/_recommend \ -H "X-API-TOKEN: " ``` -------------------------------- ### Get Full Message History for a Session Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieve all messages exchanged within a specific chat session. ```shell curl -XGET http://localhost:9000/chat/d1iah7f3edbmq3jakcs0/_history \ -H "X-API-TOKEN: " ``` -------------------------------- ### Get recommendations by tag Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieves curated content recommendations based on a specific recommendation profile tag (e.g., 'hot'). ```APIDOC ## GET /query/_recommend/{tag} ### Description Retrieves curated content recommendations based on a specific recommendation profile tag (e.g., 'hot'). ### Method GET ### Endpoint /query/_recommend/{tag} ### Parameters #### Path Parameters - **tag** (string) - Required - The tag of the recommendation profile (e.g., "hot", "trending"). #### Headers - **X-API-TOKEN** (string) - Required - API token for authentication. ### Response #### Success Response (200) - Contains a list of recommended content items similar to the default recommendations. ``` -------------------------------- ### Dropbox Connector Configuration Example Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/connectors/dropbox.md This JSON structure represents the internal configuration of the Dropbox connector after a successful OAuth flow. It includes credentials and user profile information. ```json { "connector": { "id": "dropbox-connector-id", "config": { "client_key": "YOUR_APP_KEY", "client_secret": "YOUR_APP_SECRET", "refresh_token": "AUTOMATICALLY_OBTAINED", "profile": { "account_id": "dbid:...", "email": "user@example.com", "name": "User Name" } } } } ``` -------------------------------- ### Document Suggestions (Autocomplete) Source: https://context7.com/infinilabs/coco-server/llms.txt Get real-time suggestions for documents as a user types, powering autocomplete search UIs. Requires an API token. ```shell curl -XGET "http://localhost:9000/query/_suggest?query=buss" \ -H "X-API-TOKEN: " ``` -------------------------------- ### Get Recommendations by Tag Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieve content recommendations filtered by a specific tag, such as 'hot' for trending items. Requires an API token. ```shell curl -XGET http://localhost:9000/query/_recommend/hot \ -H "X-API-TOKEN: " ``` -------------------------------- ### Hybrid Search with Filters and Pagination Source: https://context7.com/infinilabs/coco-server/llms.txt Combine keyword and semantic search (hybrid) to find relevant documents. This example includes filtering by category and implementing pagination. ```shell curl -XGET "http://localhost:9000/query/_search?query=report&category=business&search_type=hybrid&from=0&size=20" \ -H "X-API-TOKEN: " ``` -------------------------------- ### Quick Start: Run Coco Server with Added Capabilities Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/getting-started/install.md If you encounter permission issues, add these capabilities to the `docker run` command. `--security-opt seccomp=unconfined` is a last resort and not recommended for production. ```bash docker run -d \ --name cocoserver \ --cap-add=SYS_PTRACE \ --cap-add=SYS_NICE \ --security-opt seccomp=unconfined \ -p 9000:9000 \ -v coco_data_vol:/app/easysearch/data \ -v coco_config_vol:/app/easysearch/config \ -v coco_logs_vol:/app/easysearch/logs \ infinilabs/coco:0.9.0 ``` -------------------------------- ### Create Chat Session Response Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/assistant.md Example of a JSON response from the Assistant API indicating the start of a chat session and subsequent message chunks. This is typically part of a streaming response. ```json {"session_id":"d1iah7f3edbmq3jakcs0","message_id":"d1iah7f3edbmq3jakct0","message_type":"assistant","reply_to_message":"d1iah7f3edbmq3jakcsg","chunk_sequence":15,"chunk_type":"response","message_chunk":""} {"session_id":"d1iah7f3edbmq3jakcs0","message_id":"d1iah7f3edbmq3jakct0","message_type":"system","reply_to_message":"d1iah7f3edbmq3jakcsg","chunk_sequence":0,"chunk_type":"reply_end","message_chunk":"Processing completed"} ``` -------------------------------- ### Override Configuration with Environment Variables Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/configuration.md Start the Coco Server and override configuration values using environment variables. This example shows how to change the Elasticsearch password and the web binding address. ```bash ES_PASSWORD=mypassword WEB_BINDING=0.0.0.0:8080 ./bin/coco ``` -------------------------------- ### Configure MongoDB Connector with Incremental Sync Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/connectors/mongodb.md Example of configuring the MongoDB connector with an integer-based version field for incremental synchronization. This setup ensures that only changed documents are fetched on subsequent runs. ```shell curl -H 'Content-Type: application/json' -XPOST "http://localhost:9000/datasource/" -d ' { "name": "MongoDB Products", "type": "connector", "connector": { "id": "mongodb", "config": { "connection_uri": "mongodb://localhost:27017", "database": "inventory", "collection": "products", "query": "{\"active\": true}", "pagination": true, "page_size": 500, "incremental": { "enabled": true, "property": "version", "property_type": "int", "tie_breaker": "_id", "resume_from": "1" }, "field_mapping": { "enabled": true, "mapping": { "id": "_id", "title": "name", "content": "description" } } } } }' ``` -------------------------------- ### Advanced Install: Initialize Configuration from Image Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/getting-started/install.md Run a temporary container to copy default configuration files from the Docker image into your local `config` directory. This command uses volume mounting and an environment file. ```bash docker run --rm \ -v /data/cocoserver/config:/tmp/config \ --env-file /data/cocoserver/.env \ infinilabs/coco:0.9.0 \ cp -a /app/easysearch/config/. /tmp/config/ ``` -------------------------------- ### Get raw document content Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieves the raw content of a document, with a hint for the desired format (e.g., text, html, markdown). ```APIDOC ## GET /document/{id}/raw_content/{format_hint} ### Description Retrieves the raw content of a document, with a hint for the desired format (e.g., text, html, markdown). ### Method GET ### Endpoint /document/{id}/raw_content/{format_hint} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the document. - **format_hint** (string) - Required - A hint for the desired content format (e.g., "text"). #### Headers - **X-API-TOKEN** (string) - Required - API token for authentication. ### Response #### Success Response (200) - Returns the raw content of the document in the specified format. ``` -------------------------------- ### Field Value Suggestions Source: https://context7.com/infinilabs/coco-server/llms.txt Get suggestions for possible values within a specific field, ideal for populating filter dropdowns. Requires an API token. ```shell curl -XGET "http://localhost:9000/query/_suggest/field_values?field_name=category&query=rep" \ -H "X-API-TOKEN: " ``` -------------------------------- ### Get User Profile Response (JSON) Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/account/profile.md This is an example of the JSON response received when successfully retrieving a user's profile. It includes the user's ID, name, email, and a list of their assigned permissions. ```json { "id": "user123", "name": "jdoe", "email": "jdoe@example.com", "permissions": [ "coco:document:create", "coco:document:read", "coco:search:search" ] } ``` -------------------------------- ### Create MCP Server (streamable http) Source: https://context7.com/infinilabs/coco-server/llms.txt Set up an MCP server using the 'streamable http' type, pointing to a remote URL for tool execution. ```shell curl -H 'Content-Type: application/json' -XPOST http://localhost:9000/mcp_server/ -d'{ "name": "my-http-mcp", "type": "streamable http", "category": "Custom Tools", "config": { "url": "https://mcp.example.com/tools" }, "enabled": true }' ``` -------------------------------- ### Get Field Metadata Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieve metadata for specified fields, which can be used for UI rendering and understanding field properties. Requires an API token. ```shell curl -XGET "http://localhost:9000/field_meta/category,tags" \ -H "X-API-TOKEN: " ``` -------------------------------- ### Semantic Search with Datasource Filter Source: https://context7.com/infinilabs/coco-server/llms.txt Execute a semantic search, which uses vector embeddings for meaning-based retrieval. This example also filters results by a specific datasource. ```shell curl -XGET "http://localhost:9000/query/_search?query=quarterly+revenue&datasource=cu1rf03q50k43nn2pi6g&search_type=semantic" \ -H "X-API-TOKEN: " ``` -------------------------------- ### Configure Oracle Datasource Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/connectors/oracle.md This example shows how to configure a datasource to use the Oracle Connector. It includes connection details, SQL query, and optional settings like pagination and field mapping. ```shell curl -H 'Content-Type: application/json' -XPOST "http://localhost:9000/datasource/" -d ' { "name":"My Oracle Documents", "type":"connector", "connector":{ "id": "oracle", "config": { "connection_uri": "oracle://user:password@host:1521/service_name", "sql": "SELECT * from DOC ORDER BY id", "pagination": true, "page_size": 500, "last_modified_field": "updated", "field_mapping": { "enabled": true, "mapping": { "hashed": true, "id": "id", "title": "title", "url": "url", "metadata": [ { "name": "version", "value": "v" } ] } } } } }' ``` -------------------------------- ### Get Raw Document Content Source: https://context7.com/infinilabs/coco-server/llms.txt Retrieve the raw content of a document, specifying the desired format (e.g., text, html, markdown). Requires an API token. ```shell curl -XGET http://localhost:9000/document/cso9vr3q50k38nobvmcg/raw_content/text \ -H "X-API-TOKEN: " ``` -------------------------------- ### Initialize Fullscreen Widget Source: https://github.com/infinilabs/coco-server/blob/main/web/widgets/fullscreen/index.html Import and initialize the fullscreen widget with configuration options. Ensure the container element exists and provide necessary authentication and server details. ```javascript import { fullscreen } from "./index.js"; const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get('id'); const token = urlParams.get('token'); const server = urlParams.get('server'); fullscreen({ container: "#fullscreen", id, token, server, linkHref: "./index.css", }); ``` -------------------------------- ### Bearer Authentication Example Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/account/authentication.md An example of using Bearer authentication to access the account profile endpoint with a provided access token. ```shell curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ http://localhost:9000/account/profile ``` -------------------------------- ### Configure Backend Connection Source: https://github.com/infinilabs/coco-server/blob/main/web/README.md Sets up environment variables for backend service URLs. Edit the `.env.test` file to specify the main API and other service endpoints. ```dotenv VITE_SERVICE_BASE_URL=http://localhost:9000 VITE_OTHER_SERVICE_BASE_URL={ "demo": "http://localhost:9528", "/assets": "http://localhost:9000" } ``` -------------------------------- ### Create a Datasource Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/datasource.md Use this command to create a new datasource by specifying its name, type, and connector configuration. The connector ID and its specific configuration are required. ```shell curl -H 'Content-Type: application/json' -XPOST http://localhost:9000/datasource/ -d' { "name":"My Hugo Site", "type":"connector", "connector":{ "id":"hugo_site", "config":{ "urls": [ "https://pizza.rs/index.json" ] } } }' ``` -------------------------------- ### Remove Host Directories (Advanced Start Cleanup) Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/getting-started/install.md If you used the Advanced Start method with Host Directories, use this command to remove the Coco Server data directory during cleanup. This requires sudo privileges. ```bash sudo rm -rf /data/cocoserver ``` -------------------------------- ### Get Attachment Processing Status using cURL Source: https://context7.com/infinilabs/coco-server/llms.txt Check the processing status of a specific attachment. Possible states include 'pending', 'processing', 'completed', 'canceled', and 'failed'. ```shell curl -X GET http://localhost:9000/attachment/cv9q94bq50k2r0s6nobg/status \ -H "X-API-TOKEN: " ``` -------------------------------- ### Configure Yuque Datasource Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/connectors/yuque.md This example shows how to configure a datasource using the Yuque Connector. Replace 'yuque's connector id' with your actual connector ID and 'your_yuque_api_token' with your valid Yuque API token. ```shell curl -H 'Content-Type: application/json' -XPOST "http://localhost:9000/datasource/" -d ' { "name": "My Yuque", "type": "connector", "connector": { "id": "yuque's connector id", "config": { "token": "your_yuque_api_token", "include_private_book": false, "include_private_doc": false, "indexing_books": true, "indexing_docs": true, "indexing_users": true, "indexing_groups": true } } }' ``` -------------------------------- ### Hugo Generated JSON Format Example Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/connectors/hugo_site.md This is an example of the JSON format that Hugo should generate for the connector to process. It includes fields like category, content, created date, language, summary, tags, title, and URL. ```json [ { "category": "Product", "content": "INFINI Console v1.28 Released We’re excited to announce INFINI Console v1.28, the latest update from INFINI Labs! This release brings the powerful TopN feature to help you identify key metrics efficiently, alongside other performance improvements and bug fixes. Read on for all the details and enhancements in this release.\nWhat is INFINI Console? Great question! INFINI Console is a lightweight, cross-version, unified management platform designed specifically for search infrastructures. It empowers enterprises to:\nManage multiple search clusters across different versions seamlessly. Gain centralized control for efficient cluster monitoring and maintenance. INFINI Console – The Choice of Elasticsearch Professionals. Be an Elasticsearch Pro Today!\nWith INFINI Console, you can streamline the management of your search ecosystem like never before! πŸš€\nLearn more here: ", "created": "2025-01-11T17:00:00+08:00", "lang": "en", "subcategory": "Released", "summary": "Discover the new TopN feature and other enhancements in INFINI Console v1.28.", "tags": [ "Console", "TopN", "Release" ], "title": "INFINI Console v1.28 Released", "updated": null, "url": "/posts/2025/01-11-produc-released-console-topn/" } ] ``` -------------------------------- ### Build Production Bundle Source: https://github.com/infinilabs/coco-server/blob/main/web/README.md Generates a production-ready bundle of the web application using Vite. This command is used for deployment. ```bash pnpm build ``` -------------------------------- ### Get a Document Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/document.md Retrieves a specific document by its ID. ```APIDOC ## GET /document/{doc_id} ### Description Retrieves a specific document using its unique identifier. ### Method GET ### Endpoint /document/{doc_id} ### Parameters #### Path Parameters - **doc_id** (string) - Required - The unique identifier of the document to retrieve. ### Response #### Success Response (200) - **_id** (string) - The unique identifier of the document. - **_source** (object) - The source data of the document. - **found** (boolean) - Indicates if the document was found. #### Response Example ```json { "_id": "cso9vr3q50k38nobvmcg", "_source": { "id": "cso9vr3q50k38nobvmcg", "created": "2024-11-10T19:58:36.009086+08:00", "updated": "2024-11-10T19:58:36.009092+08:00", "source": { "type":"connector", "name":"My Hugo Site", "id":"e806831dacc3" } ...OMITTED... , "found": true } ``` ``` -------------------------------- ### Configure MS SQL Datasource Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/connectors/mssql.md Example request to configure an MS SQL datasource. This includes connection details, SQL query, and optional settings like pagination and field mapping. ```shell curl -H 'Content-Type: application/json' -XPOST "http://localhost:9000/datasource/" -d ' { "name":"My Microsoft SQL Server Documents", "type":"connector", "connector":{ "id": "mssql", "config": { "connection_uri": "sqlserver://username:password@host:1433?database=your_db_name", "sql": "SELECT * from DOC ORDER BY id", "pagination": true, "page_size": 500, "last_modified_field": "updated", "field_mapping": { "enabled": true, "mapping": { "hashed": true, "id": "id", "title": "title", "url": "url", "metadata": [ { "name": "version", "value": "v" } ] } } } } }' ``` -------------------------------- ### GET attachment status Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/attachment.md Retrieves the processing status of a specific attachment. ```APIDOC ## GET /attachment/{attachment_id}/status ### Description Retrieves the processing status of a specific attachment. Possible statuses include `pending`, `processing`, `completed`, `canceled`, or `failed`. ### Method GET ### Endpoint /attachment/{attachment_id}/status ### Parameters #### Path Parameters - **attachment_id** (string) - Required - The ID of the attachment whose status is to be retrieved. ### Response #### Success Response (200) - **initial_parsing** (string) - The current processing status of the attachment. ``` -------------------------------- ### Create Feishu Datasource with User Access Token Source: https://github.com/infinilabs/coco-server/blob/main/docs/content.en/docs/references/connectors/feishu.md Use this command to manually create a Feishu datasource using a user access token. Ensure the `user_access_token` is valid and specify the desired `document_types` for synchronization. ```shell curl -H 'Content-Type: application/json' -XPOST "http://localhost:9000/datasource/" -d '{ "name": "Feishu Cloud Documents", "type": "connector", "enabled": true, "connector": { "id": "feishu", "config": { "user_access_token": "u-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "document_types": ["doc", "sheet", "slides", "mindnote", "bitable", "file", "docx", "folder", "shortcut"] } }, "sync": { "enabled": true, "interval": "30s" } }' ``` -------------------------------- ### Create Chat Session and Send First Message (Streaming) Source: https://context7.com/infinilabs/coco-server/llms.txt Initiate a new chat session with a specified assistant and send the first message. Responses are streamed, with 'chunk_type' indicating the message stage. ```shell curl -N -H 'Content-Type: application/json' \ -H "X-API-TOKEN: " \ -XPOST "http://localhost:9000/chat/_create?assistant_id=cvuak1lath2dlgqqpcjg" \ -d'{ "message": "Summarize the Q3 Business Report" }' ```