내용으로 건너뛰기

Getting Started

GitHub

설치

설치

Capgo의 AI-assisted 설치를 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 스킬을 추가하려면 다음 명령어를 사용하세요:

터미널 창
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

그다음에 다음 프롬프트를 사용하세요:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-llm` plugin in my project.

만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:

터미널 창
bun add @capgo/capacitor-llm
bunx cap sync
import { CapgoLLM } from '@capgo/capacitor-llm';

API 개요

API 개요

createChat

대화 생성

새로운 대화 세션을 생성합니다.

import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.createChat();

sendMessage

메시지 전송

AI에게 메시지를 전송합니다.

import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.sendMessage({} as { chatId: string; message: string });

getReadiness

LLM 준비 상태

LLM 준비 상태를 가져옵니다.

import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.getReadiness();

모델 설정을 합니다.

  • iOS: Apple Intelligence를 사용하여 시스템 모델 경로를 설정하거나 MediaPipe 모델 경로를 제공하십시오.
  • Android: MediaPipe 모델 파일 경로 (자산 또는 파일 디렉토리)
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.setModel({} as ModelOptions);

downloadModel

다운로드 모델

URL에서 모델을 다운로드하고 적절한 위치에 저장합니다.

  • iOS: 앱의 문서 디렉토리에 다운로드
  • Android: 앱의 파일 디렉토리에 다운로드
import { CapgoLLM } from '@capgo/capacitor-llm';
await CapgoLLM.downloadModel({} as DownloadModelOptions);

타입 참조

타입 참조

ModelOptions

모델 옵션

모델 구성 옵션.

export interface ModelOptions {
/** Model path or "Apple Intelligence" for iOS system model */
path: string;
/** Model file type/extension (e.g., "task", "bin", "litertlm"). If not provided, will be extracted from path. */
modelType?: string;
/** Maximum number of tokens the model handles */
maxTokens?: number;
/** Number of tokens the model considers at each step */
topk?: number;
/** Amount of randomness in generation (0.0-1.0) */
temperature?: number;
/** Random seed for generation */
randomSeed?: number;
}

DownloadModelOptions

모델 다운로드 옵션

모델을 다운로드하는 옵션입니다.

export interface DownloadModelOptions {
/** URL of the model file to download */
url: string;
/** Optional: URL of companion file (e.g., .litertlm for Android) */
companionUrl?: string;
/** Optional: Custom filename (defaults to filename from URL) */
filename?: string;
}

DownloadModelResult

모델 다운로드 결과

모델 다운로드 결과입니다.

export interface DownloadModelResult {
/** Path where the model was saved */
path: string;
/** Path where the companion file was saved (if applicable) */
companionPath?: string;
}

AI에서 텍스트 받은 이벤트 데이터입니다.

export interface TextFromAiEvent {
/** The text content from AI - this is an incremental chunk, not the full text */
text: string;
/** The chat session ID */
chatId: string;
/** Whether this is a complete chunk (true) or partial streaming data (false) */
isChunk?: boolean;
}

AiFinishedEvent

AI 완료 이벤트

AI 완료 이벤트 데이터입니다.

export interface AiFinishedEvent {
/** The chat session ID that finished */
chatId: string;
}

DownloadProgressEvent

다운로드 진행 이벤트

다운로드 진행 이벤트 데이터

export interface DownloadProgressEvent {
/** Percentage of download completed (0-100) */
progress: number;
/** Total bytes to download */
totalBytes?: number;
/** Bytes downloaded so far */
downloadedBytes?: number;
}

ReadinessChangeEvent

준비 상태 변경 이벤트

준비 상태 변경 이벤트 데이터

export interface ReadinessChangeEvent {
/** The readiness status */
readiness: string;
}

진실의 원천

진실의 원천

이 페이지는 플러그인의 src/definitions.ts공개 API이 업스트림에서 변경될 때 다시 싱크를 실행하세요.

시작부터 계속하세요

시작하기를 계속하는 방법

만약에 시작하기 계획 대시보드와 API 연산을 위해 native 기능을 사용하기 위해 @capgo/capacitor-llm 사용하기 위해 @capgo/capacitor-llm API 개요 API 개요 소개 소개 API 키 API 키 기기 기기 구현 세부 사항에 대한 자세한 내용입니다.