Skip to main content

23 docs tagged with "add"

View All Tags

Add Authentication to a UniApp Project with CloudBase

Use @cloudbase/adapter-uni-app in a UniApp project to integrate CloudBase Auth. One codebase runs across H5, WeChat Mini Program, Alipay Mini Program, Douyin Mini Program, iOS, and Android with shared login state.

Add CloudBase AI (DeepSeek / Hunyuan) to a React Native App

RN 0.74+ mobile apps use a two-stage 'frontend fetch + backend proxy' pattern: a backend Route Handler (Next.js / Cloud Function / Cloud Run, your choice) uses @cloudbase/node-sdk's app.ai().createModel('cloudbase').streamText({model: 'deepseek-v4-flash'}) to return a text/plain streaming Response; the RN frontend reads the stream with fetch + body.getReader() (or react-native-fetch-api polyfill / XHR onprogress fallback) and renders text character by character in a FlatList. SecretId / SecretKey must never appear in the JS bundle — RN bundles are plaintext and can be decompiled by anyone.

Add CloudBase AI (DeepSeek / Hunyuan) to Next.js

Use @cloudbase/node-sdk in a Next.js Route Handler to call CloudBase AI streamText, convert AsyncIterable to ReadableStream for the frontend, and consume the streaming response in a Client Component with fetch + getReader.

Add CloudBase Authentication to Next.js

Use @cloudbase/js-sdk in a Next.js 14+ App Router project to integrate anonymous/SMS/WeChat QR Login, store login state in cookies, read identity in Server Components via cookies(), and intercept unauthenticated requests with middleware.

Build a Browser Voice Chatbot with Deepgram + CloudBase AI

Browser MediaRecorder captures audio → a Cloud Function proxies Deepgram nova-3 for STT → CloudBase AI streamText streams the reply → SpeechSynthesisUtterance reads it aloud in real time. A complete push-to-talk loop with no credentials exposed to the browser.

Build RAG with CloudBase PostgreSQL + pgvector

Enable the pgvector extension on CloudBase PostgreSQL, write a pair of ingest / retrieve Cloud Functions, and run the complete RAG pipeline: document chunking → embeddings → vector search → prompt assembly → LLM answer.

Deploy a React SPA to CloudBase Hosting

Run vite build to generate dist, upload to CloudBase static website Hosting via tcb hosting deploy, get automatic CDN acceleration + HTTPS; configure index.html as the error page fallback in the Console to resolve React Router refresh 404s.

Deploy a Vue SPA to CloudBase Hosting

Run vite build to generate dist, upload to CloudBase static website Hosting via tcb hosting deploy, get automatic CDN acceleration + HTTPS; configure index.html as the error page fallback for Vue Router history mode.

Long Document Q&A with DeepSeek V4 1M-Token Context (No RAG)

Parse PDF / entire codebases / Excel files into plain text, feed the full content into the prompt, and call CloudBase AI streamText({ model: 'deepseek-v4-pro' }) to answer questions in one shot — skipping embeddings and vector databases, ideal for one-off long-document Q&A.

Multimodal Image Understanding with DeepSeek V4-Pro in CloudBase AI

A Next.js Route Handler receives user-uploaded images, converts them to base64, and calls @cloudbase/node-sdk's app.ai().createModel('cloudbase').generateText with model: 'deepseek-v4-pro' using multimodal messages to get image descriptions, OCR results, and content analysis. Covers single image, multiple images, and image + text prompts.

Read and Write CloudBase Database in WeChat Mini Program

After login, use the db API from @cloudbase/js-sdk to perform collection CRUD, conditional queries, and real-time watch subscriptions in a WeChat Mini Program frontend, including Permission Mode selection and unsubscribe considerations.

Realtime Notifications with CloudBase Database watch

In a WeChat Mini Program with authentication already integrated, use db.collection().watch() to push order status updates, message alerts, and online presence sync. Covers the initial snapshot, docChanges increments, connection management, and when to call close().

Send WeChat Mini Program Subscribe Messages via Cloud Function

The Mini Program frontend obtains user authorization via wx.requestSubscribeMessage, the server uses cloud.openapi.subscribeMessage.send to deliver messages, covering differences between one-time and long-term subscriptions and handling of 43101/47003 errors.