### Install Dependencies for OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This command updates the dependencies for the `quickstart-oauth-server` project using Rush, ensuring all packages are correctly linked and installed for the monorepo setup. ```bash rush update ``` -------------------------------- ### Install Coze OAuth Server Dependencies Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md Commands to install the necessary Node.js dependencies for the Coze OAuth server, including a pre-installation script and the main npm install. ```bash npm run run-preinstall npm install ``` -------------------------------- ### Install and Run Coze JS Web Demo Source: https://github.com/coze-dev/coze-js/blob/main/examples/coze-js-web/README.md These commands guide you through setting up and running the Coze JS web demo locally. They cover modifying dependencies, installing packages, building the project, and starting the development server for local access. ```Shell npm run run-preinstall npm install npm run build npm start ``` -------------------------------- ### Running the Demo Application Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-websocket/README.md This snippet provides the necessary bash commands to set up and start the coze-js demo. It includes pre-installation steps, dependency installation, and the command to launch the application. ```bash npm run run-preinstall npm install npm run start ``` -------------------------------- ### Install Dependencies for React Realtime Chat Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This command installs the necessary dependencies for the `realtime-quickstart-react` project, preparing it for development. It first runs a pre-installation script, then installs all project dependencies using npm. ```bash npm run run-preinstall npm install ``` -------------------------------- ### Install Coze Node.js Example Dependencies Source: https://github.com/coze-dev/coze-js/blob/main/examples/coze-js-node/README.md Installs project dependencies, including a pre-installation script, for the Coze Node.js example. ```bash npm run run-preinstall npm install ``` -------------------------------- ### Install Dependencies for OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.md Installs project dependencies for the OAuth authentication server using Rush. ```bash rush update ``` -------------------------------- ### Coze PKCE OAuth Configuration Example Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md Example JSON configuration for the Coze PKCE OAuth flow, specifying the client ID and the base URL for the Coze API. ```json { "client_id": "您的客户端ID", "coze_api_base": "https://api.coze.cn" } ``` -------------------------------- ### Coze Device OAuth Configuration Example Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md Example JSON configuration for the Coze Device OAuth flow, specifying the client ID and the base URL for the Coze API. ```json { "client_id": "您的客户端ID", "coze_api_base": "https://api.coze.cn" } ``` -------------------------------- ### Run Coze JS Demo Application Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-call-up/README.md Commands to set up and start the Coze JS demo application. This sequence ensures all necessary pre-installation tasks are completed, dependencies are installed, and the application is launched. ```bash npm run run-preinstall npm install npm run start ``` -------------------------------- ### Run Coze JS Browser Example Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-js/README.md This snippet provides instructions for running the browser-based Coze JS example. It details how to navigate to the example directory, build the project using `rush build`, and start the development server with `npm start`. ```bash cd examples/coze-js-web rush build npm start ``` -------------------------------- ### Start React Realtime Chat Development Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This command starts the development server for the `realtime-quickstart-react` application, making it accessible in a web browser, typically at `http://localhost:3000`. ```bash npm start ``` -------------------------------- ### Start PKCE OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This command starts the PKCE OAuth server component of the `quickstart-oauth-server` project, typically listening on port 3003. It enables the PKCE OAuth flow for authentication. ```bash npm run start-pkce ``` -------------------------------- ### Start Coze PKCE OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md Bash command to start the PKCE OAuth server, which listens on port 3003. ```bash # PKCE OAuth 服务器(端口 3003) npm run start-pkce ``` -------------------------------- ### Coze Web OAuth Configuration Example Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md Example JSON configuration for the Coze Web OAuth flow, including the client ID, client secret, and the base URL for the Coze API. ```json { "client_id": "您的客户端ID", "client_secret": "您的客户端密钥", "coze_api_base": "https://api.coze.cn" } ``` -------------------------------- ### Start Various OAuth Authentication Servers Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.md Commands to start different OAuth servers (Device, JWT, PKCE, Web) on their respective ports, supporting various authentication flows. ```bash # Device OAuth server npm run start-device # port 3002 # JWT OAuth server npm run start-jwt # port 3001 # PKCE OAuth server npm run start-pkce # port 3003 # Web OAuth server npm run start-web # port 3004 ``` -------------------------------- ### Start Coze OAuth Flow Servers Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.md Commands to individually start the different Coze OAuth flow servers. Each flow runs on a dedicated port. ```bash # Device OAuth Server (Port 3002) npm run start-device # JWT OAuth Server (Port 3001) npm run start-jwt # PKCE OAuth Server (Port 3003) npm run start-pkce # Web OAuth Server (Port 3004) npm run start-web ``` -------------------------------- ### Install Project Dependencies for Coze OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.md Commands to install necessary Node.js packages for the Coze OAuth server project, including a pre-installation script. ```bash npm run run-preinstall npm install ``` -------------------------------- ### Start Coze Web OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md Bash command to start the Web OAuth server, which listens on port 3004. ```bash # Web OAuth 服务器(端口 3004) npm run start-web ``` -------------------------------- ### Start Development Server for React Real-time Voice Conversation Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.md Starts the React development server, making the real-time voice conversation application accessible locally. ```bash npm start ``` -------------------------------- ### Start Web OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This command starts the Web OAuth server component of the `quickstart-oauth-server` project, typically listening on port 3004. It enables the Web OAuth flow for authentication. ```bash npm run start-web ``` -------------------------------- ### Setup and Build Simultaneous Interpretation Extension Source: https://github.com/coze-dev/coze-js/blob/main/examples/simult-extension/README.md Provides the necessary shell commands to navigate to the project directory, install dependencies, start the development server, and compile the extension for production deployment. ```bash # Navigate to the extension directory cd examples/simult-extension # Install dependencies npm install # Start development server npm run start # Build for production npm run build ``` -------------------------------- ### Start Coze Device OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md Bash command to start the Device OAuth server, which listens on port 3002. ```bash # 设备 OAuth 服务器(端口 3002) npm run start-device ``` -------------------------------- ### Run Coze JS Node.js Chat Example Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-js/README.md This snippet outlines the steps to run the Node.js chat example. It covers navigating to the example directory, installing pre-requisites, installing dependencies, and executing the chat script, including region-specific configurations for China. ```bash cd examples/coze-js-node npm run run-preinstall npm install npx tsx ./src/chat.ts # For China region (api.coze.cn) COZE_ENV=zh npx tsx ./src/chat.ts # macOS/Linux set "COZE_ENV=zh" && npx tsx ./src/chat.ts # Windows CMD $env:COZE_ENV="zh"; npx tsx ./src/chat.ts # Windows PowerShell ``` -------------------------------- ### Coze JWT OAuth Configuration Example Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md Example JSON configuration for the Coze JWT OAuth flow, including the client ID, public key ID, private key, and the base URL for the Coze API. ```json { "client_id": "您的客户端ID", "public_key_id": "您的公钥ID", "private_key": "您的私钥", "coze_api_base": "https://api.coze.cn" } ``` -------------------------------- ### Start Device OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This command starts the Device OAuth server component of the `quickstart-oauth-server` project, typically listening on port 3002. It enables the Device OAuth flow for authentication. ```bash npm run start-device ``` -------------------------------- ### Coze PKCE OAuth Configuration File Example Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.md Example JSON configuration for the PKCE OAuth flow, specifying the client ID and Coze API base URL. ```json { "client_id": "YOUR_CLIENT_ID", "coze_api_base": "https://api.coze.cn" } ``` -------------------------------- ### Run Local Coze-JS-Taro Examples Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-taro/README.md This command-line snippet provides instructions on how to set up and run the local examples for the Coze-JS-Taro project. It involves navigating to the examples directory, configuring environment variables, and starting the development server for WeChat Mini Program. ```bash cd examples/coze-js-taro cp .env.development .env.local # Edit .env.local with your credentials npm run dev:weapp ``` -------------------------------- ### Install Dependencies for React Real-time Voice Conversation Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.md Installs project dependencies using npm, including a pre-installation script for the React-based real-time voice conversation application. ```bash npm run run-preinstall npm install ``` -------------------------------- ### Start Coze JWT OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md Bash command to start the JWT OAuth server, which listens on port 3001. ```bash # JWT OAuth 服务器(端口 3001) npm run start-jwt ``` -------------------------------- ### Coze Device OAuth Configuration File Example Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.md Example JSON configuration for the Device Code OAuth flow, specifying the client ID and Coze API base URL. ```json { "client_id": "YOUR_CLIENT_ID", "coze_api_base": "https://api.coze.cn" } ``` -------------------------------- ### Start JWT OAuth Server Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This command starts the JWT OAuth server component of the `quickstart-oauth-server` project, typically listening on port 3001. It enables the JWT OAuth flow for authentication. ```bash npm run start-jwt ``` -------------------------------- ### Coze Web OAuth Configuration File Example Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.md Example JSON configuration for the Web OAuth flow, including client ID, client secret, and Coze API base URL. ```json { "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "coze_api_base": "https://api.coze.cn" } ``` -------------------------------- ### Rush-x Publish Command Usage Examples Source: https://github.com/coze-dev/coze-js/blob/main/infra/rush-x/README.md Practical examples demonstrating various ways to use the `rush-x publish` command, including publishing specific packages, managing dependencies, setting versions, and performing dry runs. ```bash # Publish a single package rush-x publish --only @scope/package-name ``` ```bash # Publish package and its downstream dependencies rush-x publish --to @scope/package-name ``` ```bash # Publish with specific version rush-x publish --only @scope/package-name --version 1.0.0 ``` ```bash # Publish beta version rush-x publish --only @scope/package-name --bump-type beta ``` ```bash # Dry run mode rush-x publish --only @scope/package-name --dry-run ``` -------------------------------- ### Coze JWT OAuth Configuration File Example Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.md Example JSON configuration for the JWT OAuth flow, including client ID, public key ID, private key, and Coze API base URL. ```json { "client_id": "YOUR_CLIENT_ID", "public_key_id": "YOUR_PUBLIC_KEY_ID", "private_key": "YOUR_PRIVATE_KEY", "coze_api_base": "https://api.coze.cn" } ``` -------------------------------- ### Coze Device OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md API endpoints for the Coze Device OAuth flow, detailing how to obtain a device code, exchange it for an access token, and refresh the token. ```APIDOC GET /get_device_code - 获取设备码 POST /get_device_token - 使用设备码获取访问令牌 POST /refresh_device_token - 刷新访问令牌 ``` -------------------------------- ### Coze PKCE OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md API endpoints for the Coze PKCE OAuth flow, covering the initialization of the login process, exchanging an authorization code for an access token, and refreshing the token. ```APIDOC GET /pkce_login - 初始化 PKCE 登录流程 POST /get_pkce_token - 使用授权码交换访问令牌 POST /refresh_pkce_token - 刷新访问令牌 ``` -------------------------------- ### Coze Web OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md API endpoints for the Coze Web OAuth flow, including initialization of the process, exchanging an authorization code for an access token, and refreshing the token. ```APIDOC GET /web_login - 初始化 Web OAuth 流程 POST /get_web_token - 使用授权码交换访问令牌 POST /refresh_web_token - 刷新访问令牌 ``` -------------------------------- ### Rush Publish Command Usage Examples Source: https://github.com/coze-dev/coze-js/blob/main/docs/publish.md Practical examples demonstrating how to use the `rush pub` command with various options, including targeting specific packages, setting exact versions, specifying version bump types (e.g., beta), and performing dry runs without actual execution. ```bash # Publish a single package rush pub --only @scope/package-name # Publish package and its downstream dependencies rush pub --to @scope/package-name # Publish with specific version rush pub --only @scope/package-name --version 1.0.0 # Publish beta version rush pub --only @scope/package-name --bump-type beta # Dry run mode rush pub --only @scope/package-name --dry-run ``` -------------------------------- ### Run Coze Node.js Example Chat Application Source: https://github.com/coze-dev/coze-js/blob/main/examples/coze-js-node/README.md Executes the Coze Node.js chat example application. Commands are provided for both China and Global API regions, covering macOS/Linux, Windows CMD, and Windows PowerShell environments. ```bash COZE_ENV=zh npx tsx ./src/chat.ts ``` ```cmd set "COZE_ENV=zh" && npx tsx ./src/chat.ts ``` ```powershell $env:COZE_ENV="zh"; npx tsx ./src/chat.ts ``` ```bash npx tsx ./src/chat.ts ``` -------------------------------- ### Install Coze Realtime API Package Source: https://github.com/coze-dev/coze-js/blob/main/packages/realtime-api/README.md Instructions to install the @coze/realtime-api package using npm or yarn. ```bash npm install @coze/realtime-api # or yarn add @coze/realtime-api ``` -------------------------------- ### Install Coze API SDK Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-js/README.zh-CN.md Instructions for installing the Coze API SDK package using npm or pnpm package managers. This is the first step to integrate the SDK into your project. ```Shell npm install @coze/api # 或 pnpm install @coze/api ``` -------------------------------- ### Install Dependencies and Run Tests for Coze JS Project Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-js/README.md This section provides commands for setting up the development environment. It includes instructions for installing project dependencies using `rush update` and running unit tests with `npm run test`. ```bash # Install dependencies rush update # If `rush` command is not installed, see ../../README.md # Run tests npm run test ``` -------------------------------- ### Coze PKCE OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.md API endpoints for PKCE authentication, including obtaining a PKCE authentication URL, getting a PKCE token, and refreshing the token. ```APIDOC GET /pkce_login: Get PKCE authentication URL POST /get_pkce_token: Get PKCE token POST /refresh_pkce_token: Refresh token ``` -------------------------------- ### Start Coze Realtime Console Project Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-console/README.md Commands to start the Coze Realtime Console application, with options to enable or disable video streaming based on the operating system and shell. ```bash npm run start ``` ```bash REACT_APP_ENABLE_VIDEO=true npm run start ``` ```bash set "REACT_APP_ENABLE_VIDEO=true" && npm run start ``` ```bash $env:REACT_APP_ENABLE_VIDEO="true"; npm run start ``` -------------------------------- ### Start Development for a Coze Monorepo Package Source: https://github.com/coze-dev/coze-js/blob/main/README.md Once inside a package directory, this command starts the development server or process for that specific package, typically enabling live reloading or watch mode. ```bash npm run start ``` -------------------------------- ### Install Coze API SDK Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-js/README.md Instructions to install the Coze API SDK using npm or pnpm package managers. ```sh npm install @coze/api # or pnpm install @coze/api ``` -------------------------------- ### Coze Web OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.md API endpoints for Web OAuth authentication, covering obtaining a Web authentication URL, getting a Web token, and refreshing the token. ```APIDOC GET /web_login: Get Web authentication URL POST /get_web_token: Get Web token POST /refresh_web_token: Refresh token ``` -------------------------------- ### Coze Device OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.md API endpoints for managing device codes and tokens in the Coze Device OAuth flow, including obtaining a device code, getting a device token, and refreshing the token. ```APIDOC GET /get_device_code: Get device code POST /get_device_token: Get device token POST /refresh_device_token: Refresh token ``` -------------------------------- ### Install Coze Chat SDK Source: https://github.com/coze-dev/coze-js/blob/main/packages/chat-sdk/README.md Installs the Coze Chat SDK using npm or pnpm package managers. ```sh npm install @coze/chat-sdk # or pnpm install @coze/chat-sdk ``` -------------------------------- ### Install Coze UniApp SDK Dependencies Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-uniapp/README.md Provides commands to install the `@coze/uniapp-api` SDK and its required dependencies (`@coze/api`, `axios`, `reconnecting-websocket`) using either npm or pnpm. ```sh npm install @coze/uniapp-api @coze/api axios reconnecting-websocket # or pnpm install @coze/uniapp-api @coze/api axios reconnecting-websocket ``` -------------------------------- ### Install Taro Coze API SDK Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-taro/README.md This snippet demonstrates how to install the Taro Coze API SDK and its dependencies using npm or pnpm. It's the first step to setting up the SDK in your project, enabling interaction with the Coze API. ```sh npm install @coze/taro-api @coze/api # or pnpm install @coze/taro-api @coze/api ``` -------------------------------- ### Install Coze Monorepo Project Dependencies with Rush Source: https://github.com/coze-dev/coze-js/blob/main/README.md After cloning and installing global tools, this command uses Rush to install all project-specific dependencies for the Coze monorepo. ```bash rush update ``` -------------------------------- ### Navigate to Coze Node.js Configuration File Source: https://github.com/coze-dev/coze-js/blob/main/examples/coze-js-node/README.md Changes the current directory to the location of the 'config.ts' file, where API keys and bot IDs are configured. ```bash cd src/config/config.ts ``` -------------------------------- ### Install Project Dependencies for Coze Realtime Console Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-console/README.md Commands to install Node.js dependencies required to run the Coze Realtime Console application. ```bash npm run run-preinstall npm install ``` -------------------------------- ### Install project dependencies with Rush Source: https://github.com/coze-dev/coze-js/blob/main/CONTRIBUTING.md Command to install all project dependencies within the coze-js monorepo using Rush, preparing the workspace for development. ```bash rush update ``` -------------------------------- ### PKCE OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This section outlines the API endpoints for the PKCE OAuth flow. It includes endpoints for initiating the PKCE login, exchanging the code for a PKCE token, and refreshing the token. ```APIDOC GET /pkce_login: Get PKCE authentication URL POST /get_pkce_token: Get PKCE token POST /refresh_pkce_token: Refresh token ``` -------------------------------- ### Configure Local Development Environment Source: https://github.com/coze-dev/coze-js/blob/main/examples/coze-js-taro3/README.md This command initiates the local development setup by copying the default development environment file to a new local configuration. Users are expected to modify the `.env.local` file with their specific credentials and settings. ```bash cp .env.development .env.local # Edit .env.local with your credentials ``` -------------------------------- ### Coze PKCE OAuth Flow API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.md API endpoints for the PKCE OAuth flow, covering initiation of the login flow, exchanging authorization codes for access tokens, and refreshing tokens. ```APIDOC GET /pkce_login - Initiate PKCE login flow POST /get_pkce_token - Exchange authorization code for access token POST /refresh_pkce_token - Refresh access token ``` -------------------------------- ### Web OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This section outlines the API endpoints for the Web OAuth flow. It includes endpoints for initiating the Web login, exchanging the code for a Web token, and refreshing the token. ```APIDOC GET /web_login: Get Web authentication URL POST /get_web_token: Get Web token POST /refresh_web_token: Refresh token ``` -------------------------------- ### Device OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.zh-CN.md This section outlines the API endpoints for the Device OAuth flow. It includes endpoints for obtaining a device code, exchanging it for a device token, and refreshing the token. ```APIDOC GET /get_device_code: Get device code POST /get_device_token: Get device token POST /refresh_device_token: Refresh token ``` -------------------------------- ### Coze JWT OAuth API Endpoints Source: https://github.com/coze-dev/coze-js/blob/main/examples/quickstart-oauth-server/README.zh-CN.md API endpoint for the Coze JWT OAuth flow, used to obtain a JWT access token. ```APIDOC POST /get_jwt_token - 获取 JWT 访问令牌 ``` -------------------------------- ### Coze API External Documentation Links Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-taro/README.md This section provides links to the official Coze API documentation for a comprehensive overview of the API, including detailed guides on authentication and general API usage. These resources are essential for developers seeking in-depth information beyond the SDK examples. ```APIDOC API Overview: https://www.coze.com/docs/developer_guides/api_overview Authentication Guide: https://www.coze.com/docs/developer_guides/authentication ``` -------------------------------- ### Rush-x Publish Command Options Reference Source: https://github.com/coze-dev/coze-js/blob/main/infra/rush-x/README.md Comprehensive documentation for all available options of the `rush-x publish` command, covering version specification, package selection filters, and operational modes like dry run and skipping Git commits. ```APIDOC -v, --version : Specify the version number to publish -b, --bump-type : Version upgrade type, supports the following options: alpha: Alpha pre-release version (e.g., 1.0.0-alpha.abc123) beta: Beta pre-release version (e.g., 1.0.0-beta.1) patch: Patch version for bug fixes (e.g., 1.0.0 -> 1.0.1) minor: Minor version for new features (e.g., 1.0.0 -> 1.1.0) major: Major version for breaking changes (e.g., 1.0.0 -> 2.0.0) -t, --to : Publish specified packages and their downstream dependencies -f, --from : Publish specified packages and their upstream/downstream dependencies -o, --only : Publish only the specified packages -d, --dry-run: Test run mode without actual execution -s, --skip-commit: Skip Git commit step ``` -------------------------------- ### Initialize CozeAPI Client and Perform Simple Chat Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-uniapp/README.md Demonstrates how to initialize the `CozeAPI` client using a personal access token and `COZE_COM_BASE_URL`. It then shows a `quickChat` function to create and poll a chat session with a specified bot, logging the messages and usage upon completion. ```javascript import { COZE_COM_BASE_URL, RoleType, ChatStatus } from '@coze/api'; import { CozeAPI } from '@coze/uniapp-api'; // Initialize client with a personal access token const client = new CozeAPI({ token: 'your_pat_token', // Get your PAT from https://www.coze.com/open/oauth/pats baseURL: COZE_COM_BASE_URL, }); // Simple chat example async function quickChat() { try { const v = await client.chat.createAndPoll({ bot_id: 'your_bot_id', additional_messages: [ { role: RoleType.User, content: 'Hello!', content_type: 'text', }, ], }); if (v.chat.status === ChatStatus.COMPLETED) { for (const item of v.messages) { console.log('[%s]:[%s]:%s', item.role, item.type, item.content); } console.log('usage', v.chat.usage); } } catch (error) { console.error('Chat error:', error); throw error; } } ``` -------------------------------- ### Install global pnpm and Rush dependencies Source: https://github.com/coze-dev/coze-js/blob/main/CONTRIBUTING.md Command to globally install pnpm and Rush CLI tools, which are essential for managing project dependencies and monorepo operations. ```bash npm i -g pnpm@9.12.0 @microsoft/rush@5.14.0 ``` -------------------------------- ### Install Node.js 18+ using NVM Source: https://github.com/coze-dev/coze-js/blob/main/CONTRIBUTING.md Commands to install Node.js LTS/Hydrogen and set it as the default version using nvm, ensuring the correct Node.js environment for development. ```bash nvm install lts/hydrogen nvm alias default lts/hydrogen # set default node version nvm use lts/hydrogen ``` -------------------------------- ### Rush-x Publish Command Syntax Source: https://github.com/coze-dev/coze-js/blob/main/infra/rush-x/README.md Provides the basic command-line syntax for the `rush-x publish` command, indicating that it accepts various options for controlling the publishing process. ```bash rush-x publish [options] ``` -------------------------------- ### Install Global Project Dependencies (pnpm, Rush) Source: https://github.com/coze-dev/coze-js/blob/main/README.md This command installs the required global dependencies, pnpm and Rush, which are essential for managing packages and building projects within the Coze monorepo. ```bash npm i -g pnpm@9.12.0 @microsoft/rush@5.140.0 ``` -------------------------------- ### Install Node.js LTS/Hydrogen with NVM Source: https://github.com/coze-dev/coze-js/blob/main/README.md This snippet demonstrates how to install Node.js LTS/Hydrogen using nvm, set it as the default version, and activate it for the current session. This is a prerequisite for developing with the Coze monorepo. ```bash nvm install lts/hydrogen nvm alias default lts/hydrogen # set default node version nvm use lts/hydrogen ``` -------------------------------- ### Initialize CozeAPI Client and Perform Basic Chat Source: https://github.com/coze-dev/coze-js/blob/main/packages/coze-taro/README.md This example shows how to initialize the CozeAPI client with a Personal Access Token and perform a simple chat interaction. It demonstrates creating a chat, polling for completion, and logging the messages and usage from the bot's response. ```javascript import { COZE_COM_BASE_URL, RoleType, ChatStatus } from '@coze/api'; import { CozeAPI } from '@coze/taro-api'; // Initialize client with your Personal Access Token const client = new CozeAPI({ token: 'your_pat_token', // Get your PAT from https://www.coze.com/open/oauth/pats baseURL: COZE_COM_BASE_URL, }); // Simple chat example async function quickChat() { try { const v = await client.chat.createAndPoll({ bot_id: 'your_bot_id', additional_messages: [ { role: RoleType.User, content: 'Hello!', content_type: 'text', }, ], }); if (v.chat.status === ChatStatus.COMPLETED) { for (const item of v.messages) { console.log('[%s]:[%s]:%s', item.role, item.type, item.content); } console.log('usage', v.chat.usage); } } catch (error) { console.error('Chat error:', error); throw error; } } ``` -------------------------------- ### Configure Authentication Method in React Coze App Source: https://github.com/coze-dev/coze-js/blob/main/examples/realtime-quickstart-react/README.md Demonstrates how to select different authentication methods (PAT, Device, JWT, PKCE, Web OAuth) by commenting or uncommenting the corresponding 'useToken' hook in 'src/App.tsx'. ```typescript const { getToken } = useTokenWithPat(); // const { getToken } = useTokenWithDevice(); // const { getToken } = useTokenWithJWT(); // const { getToken } = useTokenWithPKCE(); // const { getToken } = useTokenWithWeb(); ``` -------------------------------- ### Clone coze-js repository Source: https://github.com/coze-dev/coze-js/blob/main/CONTRIBUTING.md Command to clone the coze-js project repository from GitHub, initiating the local development setup. ```bash git clone git@github.com:coze-dev/coze-js.git ``` -------------------------------- ### Initialize and Use Coze Realtime Client Source: https://github.com/coze-dev/coze-js/blob/main/packages/realtime-api/README.md Demonstrates how to initialize the RealtimeClient with various configuration options, establish a connection, perform core operations like disconnect and toggle microphone, and set up event listeners for client and server events. ```typescript import { RealtimeClient, EventNames, RealtimeUtils } from "@coze/realtime-api"; // Initialize the client const client = new RealtimeClient({ baseURL: "https://api.coze.cn", accessToken: "your_access_token", // or // accessToken: async () => { // // refresh token if expired // return 'your_oauth_token'; // }, botId: "your_bot_id", voiceId: "your_voice_id", // Optional: Specify voice ID conversationId: "conversation_id", // Optional: For conversation continuity debug: true, // Optional: Enable debug logging getRoomInfo: async () => { // Customize get room info return { token: "your_token", uid: "your_uid", room_id: "your_room_id", app_id: "your_app_id" }; }, allowPersonalAccessTokenInBrowser: true, // Optional: Enable PAT token usage in browser audioMutedDefault: false, // Optional: Initial audio state (default: false) suppressStationaryNoise: false, // Optional: Enable stationary noise suppression(default: false) suppressNonStationaryNoise: false, // Optional: Enable non-stationary noise suppression(default: false) videoConfig: { // Optional: Video configuration videoOnDefault: true, // Optional: Whether to turn on video by default, defaults to true renderDom: 'local-player' // Optional: The DOM element to render the video stream to } }); // Essential Setup async function initializeVoiceChat() { // 1. Verify device permissions const result = await RealtimeUtils.checkDevicePermission(); if (!result.audio) { throw new Error("Microphone access required"); } // 2. Establish connection await client.connect(); } // Core Operations const operations = { disconnect: () => client.disconnect(), interrupt: () => client.interrupt(), toggleMicrophone: (enabled: boolean) => client.setAudioEnable(enabled), checkConnection: () => client.isConnected, // get rtc engine instance, for detail visit https://www.volcengine.com/docs/6348/104478#rtcengine getRtcEngine: () => client.getRtcEngine() }; // Event Handling function setupEventListeners() { // Listen to all events client.on(EventNames.EventNames, console.log); // Client-side events only client.on(EventNames.ALL_CLIENT, console.log); // Server-side events only client.on(EventNames.ALL_SERVER, console.log); // Specific event handling client.on(EventNames.CONNECTED, (event) => { console.log("Connection established:", event); }); } ```