2712 lines
74 KiB
JSON
2712 lines
74 KiB
JSON
{
|
|
"openapi": "3.1.1",
|
|
"info": {
|
|
"title": "Trilium Notes 동기화 서버 API",
|
|
"version": "0.94.0",
|
|
"description": "Trilium Notes와 TriliumNext Notes에서 사용하는 내부 동기화 서버 API입니다.\n\n공식 지원 외부 API는 [ETAPI 안내](https://triliumnext.github.io/Docs/Wiki/etapi.html)를 참고하세요.\n\n이 문서에는 아직 모든 경로가 나와 있지 않습니다. 전체 목록은 [경로 제어 코드](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/routes.ts)를 확인하세요.",
|
|
"contact": {
|
|
"name": "TriliumNext 문제 신고",
|
|
"url": "https://github.com/TriliumNext/Notes/issues"
|
|
},
|
|
"license": {
|
|
"name": "GNU Free Documentation License 1.3 (or later)",
|
|
"url": "https://www.gnu.org/licenses/fdl-1.3"
|
|
}
|
|
},
|
|
"paths": {
|
|
"/api/setup/sync-seed": {
|
|
"get": {
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "documentSecret 값 동기화",
|
|
"description": "로그인의 첫 단계입니다.",
|
|
"operationId": "setup-sync-seed",
|
|
"responses": {
|
|
"200": {
|
|
"description": "작업 성공",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"syncVersion": {
|
|
"type": "integer",
|
|
"example": 34
|
|
},
|
|
"options": {
|
|
"type": "object",
|
|
"properties": {
|
|
"documentSecret": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"user-password": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/api/anthropic/models": {
|
|
"post": {
|
|
"summary": "사용 가능한 Anthropic 모델 조회",
|
|
"operationId": "anthropic-list-models",
|
|
"requestBody": {
|
|
"required": false,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"baseUrl": {
|
|
"type": "string",
|
|
"description": "사용자 지정 Anthropic API 기본 주소. 생략할 수 있습니다."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "사용 가능한 Anthropic 모델 목록",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"chatModels": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"embeddingModels": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "모델 목록 조회 오류"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/app-info": {
|
|
"get": {
|
|
"summary": "설치 정보 조회",
|
|
"operationId": "app-info",
|
|
"externalDocs": {
|
|
"description": "서버 구현체",
|
|
"url": "https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/app_info.ts"
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "설치 정보",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"appVersion": {
|
|
"type": "string",
|
|
"example": "0.91.6"
|
|
},
|
|
"dbVersion": {
|
|
"type": "integer",
|
|
"example": 228
|
|
},
|
|
"nodeVersion": {
|
|
"type": "string",
|
|
"description": "process.version 값"
|
|
},
|
|
"syncVersion": {
|
|
"type": "integer",
|
|
"example": 34
|
|
},
|
|
"buildDate": {
|
|
"type": "string",
|
|
"example": "2024-09-07T18:36:34Z"
|
|
},
|
|
"buildRevision": {
|
|
"type": "string",
|
|
"example": "7c0d6930fa8f20d269dcfbcbc8f636a25f6bb9a7"
|
|
},
|
|
"dataDirectory": {
|
|
"type": "string",
|
|
"example": "/var/lib/trilium"
|
|
},
|
|
"clipperProtocolVersion": {
|
|
"type": "string",
|
|
"example": "1.0"
|
|
},
|
|
"utcDateTime": {
|
|
"$ref": "#/components/schemas/UtcDateTime"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/api/branches/{branchId}": {
|
|
"delete": {
|
|
"summary": "가지 삭제 (노트 복제본)",
|
|
"operationId": "branches-delete",
|
|
"parameters": [
|
|
{
|
|
"name": "branchId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/components/schemas/BranchId"
|
|
}
|
|
},
|
|
{
|
|
"name": "taskId",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "작업 그룹 식별자"
|
|
},
|
|
{
|
|
"name": "eraseNotes",
|
|
"in": "query",
|
|
"schema": {
|
|
"type": "boolean"
|
|
},
|
|
"required": false,
|
|
"description": "노트를 즉시 지울지 여부"
|
|
},
|
|
{
|
|
"name": "last",
|
|
"in": "query",
|
|
"schema": {
|
|
"type": "boolean"
|
|
},
|
|
"required": true,
|
|
"description": "이 작업 그룹의 마지막 요청인지 여부"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "가지 삭제 성공",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"noteDeleted": {
|
|
"type": "boolean",
|
|
"description": "마지막 노트 복제본이 삭제됐는지 여부"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"data"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/similar/{noteId}": {
|
|
"get": {
|
|
"summary": "주어진 노트 ID를 기준으로 비슷한 노트 찾기",
|
|
"operationId": "embeddings-similar-by-note",
|
|
"parameters": [
|
|
{
|
|
"name": "noteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "providerId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"default": "openai",
|
|
"description": "임베딩 제공자 ID"
|
|
},
|
|
{
|
|
"name": "modelId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"default": "text-embedding-3-small",
|
|
"description": "임베딩 모델 ID"
|
|
},
|
|
{
|
|
"name": "limit",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer"
|
|
},
|
|
"default": 10,
|
|
"description": "반환할 비슷한 노트의 최대 개수"
|
|
},
|
|
{
|
|
"name": "threshold",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "number",
|
|
"format": "float"
|
|
},
|
|
"default": 0.7,
|
|
"description": "유사도 기준값 (0.0~1.0)"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "비슷한 노트 목록",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"similarNotes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"noteId": {
|
|
"type": "string"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"similarity": {
|
|
"type": "number",
|
|
"format": "float"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "잘못된 요청 매개변수"
|
|
},
|
|
"404": {
|
|
"description": "노트를 찾을 수 없음"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/search": {
|
|
"post": {
|
|
"summary": "입력한 글과 비슷한 노트 검색",
|
|
"operationId": "embeddings-search-by-text",
|
|
"parameters": [
|
|
{
|
|
"name": "providerId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"default": "openai",
|
|
"description": "임베딩 제공자 ID"
|
|
},
|
|
{
|
|
"name": "modelId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"default": "text-embedding-3-small",
|
|
"description": "임베딩 모델 ID"
|
|
},
|
|
{
|
|
"name": "limit",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer"
|
|
},
|
|
"default": 10,
|
|
"description": "반환할 비슷한 노트의 최대 개수"
|
|
},
|
|
{
|
|
"name": "threshold",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "number",
|
|
"format": "float"
|
|
},
|
|
"default": 0.7,
|
|
"description": "유사도 기준값 (0.0~1.0)"
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"text": {
|
|
"type": "string",
|
|
"description": "검색에 사용할 글"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "비슷한 노트 목록",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"similarNotes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"noteId": {
|
|
"type": "string"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"similarity": {
|
|
"type": "number",
|
|
"format": "float"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "잘못된 요청 매개변수"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/providers": {
|
|
"get": {
|
|
"summary": "사용 가능한 임베딩 제공자 조회",
|
|
"operationId": "embeddings-get-providers",
|
|
"responses": {
|
|
"200": {
|
|
"description": "사용 가능한 임베딩 제공자 목록",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"providers": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"isEnabled": {
|
|
"type": "boolean"
|
|
},
|
|
"priority": {
|
|
"type": "integer"
|
|
},
|
|
"config": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/providers/{providerId}": {
|
|
"patch": {
|
|
"summary": "임베딩 제공자 설정 변경",
|
|
"operationId": "embeddings-update-provider",
|
|
"parameters": [
|
|
{
|
|
"name": "providerId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "변경할 제공자 ID"
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"enabled": {
|
|
"type": "boolean",
|
|
"description": "제공자 사용 여부"
|
|
},
|
|
"priority": {
|
|
"type": "integer",
|
|
"description": "우선순위. 숫자가 작을수록 우선합니다."
|
|
},
|
|
"config": {
|
|
"type": "object",
|
|
"description": "제공자별 설정"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "제공자 변경 성공",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "잘못된 제공자 ID 또는 설정"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/reprocess": {
|
|
"post": {
|
|
"summary": "모든 노트의 임베딩 다시 처리",
|
|
"operationId": "embeddings-reprocess-all",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"providerId": {
|
|
"type": "string",
|
|
"description": "다시 처리할 때 사용할 제공자 ID"
|
|
},
|
|
"modelId": {
|
|
"type": "string",
|
|
"description": "다시 처리할 때 사용할 모델 ID"
|
|
},
|
|
"forceReprocess": {
|
|
"type": "boolean",
|
|
"description": "임베딩이 이미 있는 노트도 다시 처리할지 여부"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "다시 처리 시작",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"jobId": {
|
|
"type": "string"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "잘못된 제공자 ID 또는 설정"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/queue-status": {
|
|
"get": {
|
|
"summary": "임베딩 처리 대기열 상태 조회",
|
|
"operationId": "embeddings-queue-status",
|
|
"parameters": [
|
|
{
|
|
"name": "jobId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "특정 처리 작업의 상태를 조회할 작업 ID. 생략할 수 있습니다."
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "대기열 상태 정보",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"status": {
|
|
"type": "string",
|
|
"enum": [
|
|
"idle",
|
|
"processing",
|
|
"paused"
|
|
]
|
|
},
|
|
"progress": {
|
|
"type": "number",
|
|
"format": "float",
|
|
"description": "진행률 (0~100)"
|
|
},
|
|
"details": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/stats": {
|
|
"get": {
|
|
"summary": "임베딩 통계 조회",
|
|
"operationId": "embeddings-stats",
|
|
"responses": {
|
|
"200": {
|
|
"description": "임베딩 통계",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"stats": {
|
|
"type": "object",
|
|
"properties": {
|
|
"totalEmbeddings": {
|
|
"type": "integer"
|
|
},
|
|
"providers": {
|
|
"type": "object"
|
|
},
|
|
"modelCounts": {
|
|
"type": "object"
|
|
},
|
|
"lastUpdated": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/failed": {
|
|
"get": {
|
|
"summary": "임베딩 생성에 실패한 노트 목록 조회",
|
|
"operationId": "embeddings-failed-notes",
|
|
"responses": {
|
|
"200": {
|
|
"description": "실패한 노트 목록",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"failedNotes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"noteId": {
|
|
"type": "string"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"error": {
|
|
"type": "string"
|
|
},
|
|
"failedAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/retry/{noteId}": {
|
|
"post": {
|
|
"summary": "실패한 노트의 임베딩 생성 재시도",
|
|
"operationId": "embeddings-retry-note",
|
|
"parameters": [
|
|
{
|
|
"name": "noteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "다시 시도할 노트 ID"
|
|
},
|
|
{
|
|
"name": "providerId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "사용할 제공자 ID. 생략하면 설정된 기본 제공자를 사용합니다."
|
|
},
|
|
{
|
|
"name": "modelId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "사용할 모델 ID. 생략하면 제공자의 기본 모델을 사용합니다."
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "재시도 결과",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "잘못된 요청"
|
|
},
|
|
"404": {
|
|
"description": "노트를 찾을 수 없음"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/retry-all-failed": {
|
|
"post": {
|
|
"summary": "실패한 모든 노트의 임베딩 생성 재시도",
|
|
"operationId": "embeddings-retry-all-failed",
|
|
"requestBody": {
|
|
"required": false,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"providerId": {
|
|
"type": "string",
|
|
"description": "사용할 제공자 ID. 생략하면 설정된 기본 제공자를 사용합니다."
|
|
},
|
|
"modelId": {
|
|
"type": "string",
|
|
"description": "사용할 모델 ID. 생략하면 제공자의 기본 모델을 사용합니다."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "재시도 시작",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"jobId": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/rebuild-index": {
|
|
"post": {
|
|
"summary": "벡터 저장소 색인 다시 만들기",
|
|
"operationId": "embeddings-rebuild-index",
|
|
"responses": {
|
|
"200": {
|
|
"description": "다시 만들기 시작",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"jobId": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/embeddings/index-rebuild-status": {
|
|
"get": {
|
|
"summary": "벡터 색인 다시 만들기 상태 조회",
|
|
"operationId": "embeddings-rebuild-status",
|
|
"parameters": [
|
|
{
|
|
"name": "jobId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "특정 색인 작업의 상태를 조회할 작업 ID. 생략할 수 있습니다."
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "색인 다시 만들기 상태 정보",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"status": {
|
|
"type": "string",
|
|
"enum": [
|
|
"idle",
|
|
"in_progress",
|
|
"completed",
|
|
"failed"
|
|
]
|
|
},
|
|
"progress": {
|
|
"type": "number",
|
|
"format": "float",
|
|
"description": "진행률 (0~100)"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"details": {
|
|
"type": "object",
|
|
"properties": {
|
|
"startTime": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"processed": {
|
|
"type": "integer"
|
|
},
|
|
"total": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/sessions": {
|
|
"post": {
|
|
"summary": "새 언어 모델 대화 생성",
|
|
"operationId": "llm-create-session",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"title": {
|
|
"type": "string",
|
|
"description": "대화 제목"
|
|
},
|
|
"systemPrompt": {
|
|
"type": "string",
|
|
"description": "도우미의 동작 방식을 지정할 시스템 메시지"
|
|
},
|
|
"temperature": {
|
|
"type": "number",
|
|
"description": "언어 모델의 무작위성 설정값 (0.0~1.0)"
|
|
},
|
|
"maxTokens": {
|
|
"type": "integer",
|
|
"description": "응답에서 생성할 최대 토큰 수"
|
|
},
|
|
"model": {
|
|
"type": "string",
|
|
"description": "사용할 모델. 제공자에 따라 다릅니다."
|
|
},
|
|
"provider": {
|
|
"type": "string",
|
|
"description": "사용할 언어 모델 제공자. 예: openai 또는 anthropic 또는 ollama"
|
|
},
|
|
"contextNoteId": {
|
|
"type": "string",
|
|
"description": "대화의 참고 자료로 사용할 노트 ID"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "대화 생성 성공",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"sessionId": {
|
|
"type": "string"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"createdAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
},
|
|
"get": {
|
|
"summary": "모든 대화 조회",
|
|
"operationId": "llm-list-sessions",
|
|
"responses": {
|
|
"200": {
|
|
"description": "대화 목록",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"createdAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"lastActive": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"messageCount": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/sessions/{sessionId}": {
|
|
"get": {
|
|
"summary": "특정 대화 조회",
|
|
"operationId": "llm-get-session",
|
|
"parameters": [
|
|
{
|
|
"name": "sessionId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "대화 상세 정보",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"messages": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"role": {
|
|
"type": "string",
|
|
"enum": [
|
|
"user",
|
|
"assistant",
|
|
"system"
|
|
]
|
|
},
|
|
"content": {
|
|
"type": "string"
|
|
},
|
|
"timestamp": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"createdAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"lastActive": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "대화를 찾을 수 없음"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
},
|
|
"delete": {
|
|
"summary": "대화 삭제",
|
|
"operationId": "llm-delete-session",
|
|
"parameters": [
|
|
{
|
|
"name": "sessionId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "대화 삭제 성공"
|
|
},
|
|
"404": {
|
|
"description": "대화를 찾을 수 없음"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/chat/{chatNoteId}": {
|
|
"patch": {
|
|
"summary": "대화 설정 변경",
|
|
"operationId": "llm-update-chat",
|
|
"parameters": [
|
|
{
|
|
"name": "chatNoteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "대화 노트 ID. 이전 이름은 sessionId입니다."
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"title": {
|
|
"type": "string",
|
|
"description": "변경할 대화 제목"
|
|
},
|
|
"systemPrompt": {
|
|
"type": "string",
|
|
"description": "변경할 시스템 프롬프트"
|
|
},
|
|
"temperature": {
|
|
"type": "number",
|
|
"description": "변경할 무작위성 설정값"
|
|
},
|
|
"maxTokens": {
|
|
"type": "integer",
|
|
"description": "변경할 최대 토큰 수"
|
|
},
|
|
"model": {
|
|
"type": "string",
|
|
"description": "변경할 모델"
|
|
},
|
|
"provider": {
|
|
"type": "string",
|
|
"description": "변경할 제공자"
|
|
},
|
|
"contextNoteId": {
|
|
"type": "string",
|
|
"description": "참고 자료로 사용할 새 노트 ID"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "대화 변경 성공",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"updatedAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "대화를 찾을 수 없음"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/chat/{chatNoteId}/messages": {
|
|
"post": {
|
|
"summary": "언어 모델에 메시지를 보내고 응답 받기",
|
|
"operationId": "llm-send-message",
|
|
"parameters": [
|
|
{
|
|
"name": "chatNoteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "대화 노트 ID. 이전 이름은 sessionId입니다."
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"message": {
|
|
"type": "string",
|
|
"description": "언어 모델에 보낼 사용자 메시지"
|
|
},
|
|
"options": {
|
|
"type": "object",
|
|
"description": "이 메시지에만 적용할 매개변수. 생략할 수 있습니다.",
|
|
"properties": {
|
|
"temperature": {
|
|
"type": "number"
|
|
},
|
|
"maxTokens": {
|
|
"type": "integer"
|
|
},
|
|
"model": {
|
|
"type": "string"
|
|
},
|
|
"provider": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"includeContext": {
|
|
"type": "boolean",
|
|
"description": "관련 노트를 참고 자료에 포함할지 여부"
|
|
},
|
|
"useNoteContext": {
|
|
"type": "boolean",
|
|
"description": "대화에 지정된 참고 노트를 사용할지 여부"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "언어 모델 응답",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"response": {
|
|
"type": "string"
|
|
},
|
|
"sources": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"noteId": {
|
|
"type": "string"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"similarity": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"sessionId": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "대화를 찾을 수 없음"
|
|
},
|
|
"500": {
|
|
"description": "요청 처리 오류"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/indexes/stats": {
|
|
"get": {
|
|
"summary": "언어 모델 지식 자료의 색인 상태 통계 조회",
|
|
"operationId": "llm-index-stats",
|
|
"responses": {
|
|
"200": {
|
|
"description": "색인 통계 조회 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/indexes": {
|
|
"post": {
|
|
"summary": "지식 자료 색인 작업 시작 또는 계속하기",
|
|
"operationId": "llm-start-indexing",
|
|
"requestBody": {
|
|
"required": false,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"force": {
|
|
"type": "boolean",
|
|
"description": "모든 노트의 색인을 강제로 다시 만들지 여부"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "색인 작업 시작 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/indexes/failed": {
|
|
"get": {
|
|
"summary": "색인에 실패한 노트 목록 조회",
|
|
"operationId": "llm-failed-indexes",
|
|
"parameters": [
|
|
{
|
|
"name": "limit",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer",
|
|
"default": 100
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "색인 실패 목록 조회 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
},
|
|
"put": {
|
|
"summary": "실패한 모든 노트의 색인 재시도",
|
|
"operationId": "llm-retry-all-indexes",
|
|
"responses": {
|
|
"200": {
|
|
"description": "실패한 모든 색인 작업 재시도 시작 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/indexes/notes/{noteId}": {
|
|
"put": {
|
|
"summary": "이전에 실패한 특정 노트의 색인 재시도",
|
|
"operationId": "llm-retry-index",
|
|
"parameters": [
|
|
{
|
|
"name": "noteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "색인 재시도 시작 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
},
|
|
"post": {
|
|
"summary": "특정 노트를 언어 모델 지식 자료에 색인",
|
|
"operationId": "llm-index-note",
|
|
"parameters": [
|
|
{
|
|
"name": "noteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "노트 색인 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/indexes/notes/similar": {
|
|
"get": {
|
|
"summary": "검색어와 비슷한 노트 찾기",
|
|
"operationId": "llm-find-similar-notes",
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "contextNoteId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "limit",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer",
|
|
"default": 5
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "비슷한 노트 검색 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/indexes/context": {
|
|
"get": {
|
|
"summary": "지식 자료를 바탕으로 언어 모델 질문의 참고 자료 생성",
|
|
"operationId": "llm-generate-context",
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "contextNoteId",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "depth",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer",
|
|
"default": 2
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "참고 자료 생성 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/chat/{chatNoteId}/messages/stream": {
|
|
"post": {
|
|
"summary": "WebSocket으로 언어 모델에 메시지를 보내고 응답을 순차 수신",
|
|
"operationId": "llm-stream-message",
|
|
"parameters": [
|
|
{
|
|
"name": "chatNoteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "메시지를 보낼 대화 노트 ID. 이전 이름은 sessionId입니다."
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"content": {
|
|
"type": "string",
|
|
"description": "언어 모델에 보낼 사용자 메시지"
|
|
},
|
|
"useAdvancedContext": {
|
|
"type": "boolean",
|
|
"description": "고급 참고 자료 추출 기능을 사용할지 여부"
|
|
},
|
|
"showThinking": {
|
|
"type": "boolean",
|
|
"description": "응답에 생각 과정을 표시할지 여부"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "순차 전송 시작 성공"
|
|
},
|
|
"404": {
|
|
"description": "대화를 찾을 수 없음"
|
|
},
|
|
"500": {
|
|
"description": "요청 처리 오류"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/login/sync": {
|
|
"post": {
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "documentSecret으로 로그인",
|
|
"description": "`hash` 매개변수는 `documentSecret`과 `timestamp`를 사용한 HMAC으로 계산합니다.",
|
|
"operationId": "login-sync",
|
|
"externalDocs": {
|
|
"description": "HMAC 계산",
|
|
"url": "https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/utils.ts#L62-L66"
|
|
},
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"timestamp": {
|
|
"$ref": "#/components/schemas/UtcDateTime"
|
|
},
|
|
"hash": {
|
|
"type": "string"
|
|
},
|
|
"syncVersion": {
|
|
"type": "integer",
|
|
"example": 34
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "작업 성공",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"syncVersion": {
|
|
"type": "integer",
|
|
"example": 34
|
|
},
|
|
"options": {
|
|
"type": "object",
|
|
"properties": {
|
|
"documentSecret": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "동기화 버전 또는 문서 비밀 값 불일치",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"message": {
|
|
"type": "string",
|
|
"example": "동기화 버전이 다릅니다. 로컬 버전은 ${server syncVersion}이며 원격 버전은 ${requested syncVersion}입니다. 양쪽에서 같은 Trilium 버전을 사용하는 것이 좋습니다."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "타임스탬프 불일치",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"message": {
|
|
"type": "string",
|
|
"example": "인증 요청 시각이 맞지 않습니다. 클라이언트와 서버의 시각이 올바른지 확인하세요. 두 시계의 차이는 5분 미만이어야 합니다."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/notes/{noteId}": {
|
|
"get": {
|
|
"summary": "노트 메타데이터 조회",
|
|
"operationId": "notes-get",
|
|
"parameters": [
|
|
{
|
|
"name": "noteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/components/schemas/NoteId"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "노트 메타데이터",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/components/schemas/Note"
|
|
},
|
|
{
|
|
"$ref": "#/components/schemas/Timestamps"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"data"
|
|
]
|
|
},
|
|
"delete": {
|
|
"summary": "노트 삭제",
|
|
"operationId": "notes-delete",
|
|
"parameters": [
|
|
{
|
|
"name": "noteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/components/schemas/NoteId"
|
|
}
|
|
},
|
|
{
|
|
"name": "taskId",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "작업 그룹 식별자"
|
|
},
|
|
{
|
|
"name": "eraseNotes",
|
|
"in": "query",
|
|
"schema": {
|
|
"type": "boolean"
|
|
},
|
|
"required": false,
|
|
"description": "노트를 즉시 지울지 여부"
|
|
},
|
|
{
|
|
"name": "last",
|
|
"in": "query",
|
|
"schema": {
|
|
"type": "boolean"
|
|
},
|
|
"required": true,
|
|
"description": "이 작업 그룹의 마지막 요청인지 여부"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "노트 삭제 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"data"
|
|
]
|
|
}
|
|
},
|
|
"/api/notes/{noteId}/blob": {
|
|
"get": {
|
|
"summary": "노트 본문 조회",
|
|
"operationId": "notes-blob",
|
|
"parameters": [
|
|
{
|
|
"name": "noteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/components/schemas/NoteId"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"304": {
|
|
"description": "노트 본문",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Blob"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"data"
|
|
]
|
|
}
|
|
},
|
|
"/api/notes/{noteId}/metadata": {
|
|
"get": {
|
|
"summary": "노트 메타데이터 조회 (시각 정보만)",
|
|
"operationId": "notes-metadata",
|
|
"parameters": [
|
|
{
|
|
"name": "noteId",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/components/schemas/NoteId"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "노트 메타데이터",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Timestamps"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"data"
|
|
]
|
|
}
|
|
},
|
|
"/api/llm/providers/ollama/models": {
|
|
"get": {
|
|
"summary": "사용 가능한 Ollama 모델 조회",
|
|
"operationId": "ollama-list-models",
|
|
"parameters": [
|
|
{
|
|
"name": "baseUrl",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "사용자 지정 Ollama API 기본 주소. 생략할 수 있습니다."
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "사용 가능한 Ollama 모델 목록",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"models": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "모델 목록 조회 오류"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/openai/models": {
|
|
"post": {
|
|
"summary": "사용 가능한 OpenAI 모델 조회",
|
|
"operationId": "openai-list-models",
|
|
"requestBody": {
|
|
"required": false,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"baseUrl": {
|
|
"type": "string",
|
|
"description": "사용자 지정 OpenAI API 기본 주소. 생략할 수 있습니다."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "사용 가능한 OpenAI 모델 목록",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"chatModels": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"embeddingModels": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "모델 목록 조회 오류"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"llm"
|
|
]
|
|
}
|
|
},
|
|
"/api/sync/changed": {
|
|
"get": {
|
|
"summary": "동기화 변경 사항 가져오기",
|
|
"operationId": "sync-changed",
|
|
"externalDocs": {
|
|
"description": "서버 구현체",
|
|
"url": "https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/api/sync.ts"
|
|
},
|
|
"parameters": [
|
|
{
|
|
"in": "query",
|
|
"name": "instanceId",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "로컬 인스턴스 ID"
|
|
},
|
|
{
|
|
"in": "query",
|
|
"name": "lastEntityChangeId",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer"
|
|
},
|
|
"description": "로컬에 있는 마지막 변경 ID"
|
|
},
|
|
{
|
|
"in": "query",
|
|
"name": "logMarkerId",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "서버 로그에서 이 요청을 구분할 표시"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "동기화 변경 사항. 응답 크기는 약 1메가바이트로 제한됩니다.",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"entityChanges": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/EntityChange"
|
|
}
|
|
},
|
|
"lastEntityChangeId": {
|
|
"type": "integer",
|
|
"description": "`outstandingPullCount > 0`이면 다음 요청의 매개변수에 이 값을 넣어 계속 가져옵니다."
|
|
},
|
|
"outstandingPullCount": {
|
|
"type": "integer",
|
|
"example": 42,
|
|
"description": "원격 서버가 아직 반환하지 않은 변경 사항 수"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"sync"
|
|
]
|
|
}
|
|
},
|
|
"/api/sync/update": {
|
|
"put": {
|
|
"summary": "동기화 변경 사항 보내기",
|
|
"description": "기본 사용법: `pageCount = 1`과 `pageIndex = 0`으로 설정하고 `requestId`는 생략합니다. 요청 본문에 엔터티 변경 사항을 넣습니다.",
|
|
"operationId": "sync-update",
|
|
"externalDocs": {
|
|
"description": "서버 구현체",
|
|
"url": "https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/api/sync.ts"
|
|
},
|
|
"parameters": [
|
|
{
|
|
"in": "header",
|
|
"name": "pageCount",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
{
|
|
"in": "header",
|
|
"name": "pageIndex",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
{
|
|
"in": "header",
|
|
"name": "requestId",
|
|
"schema": {
|
|
"type": "string",
|
|
"description": "여러 페이지로 나눈 요청을 구분할 ID"
|
|
}
|
|
},
|
|
{
|
|
"in": "query",
|
|
"name": "logMarkerId",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "서버 로그에서 이 요청을 구분할 표시"
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"instanceId": {
|
|
"type": "string",
|
|
"description": "로컬 인스턴스 ID"
|
|
},
|
|
"entities": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/EntityChange"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "변경 사항 처리 성공"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"sync"
|
|
]
|
|
}
|
|
},
|
|
"/api/tree": {
|
|
"get": {
|
|
"summary": "트리 데이터 조회",
|
|
"operationId": "tree",
|
|
"externalDocs": {
|
|
"description": "서버 구현체",
|
|
"url": "https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/api/tree.ts"
|
|
},
|
|
"parameters": [
|
|
{
|
|
"in": "query",
|
|
"name": "subTreeNoteId",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "트리 데이터를 이 노트와 하위 노트로 제한"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "노트와 가지 및 속성",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"branches": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Branch"
|
|
}
|
|
},
|
|
"notes": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Note"
|
|
}
|
|
},
|
|
"attributes": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Attribute"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"session": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"data"
|
|
]
|
|
}
|
|
},
|
|
"/login": {
|
|
"post": {
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "비밀번호로 로그인",
|
|
"description": "일부 API 호출에 필요한 Trilium 세션을 발급합니다. 사용자가 TOTP 인증을 설정한 경우에만 `totpToken`이 필요합니다.",
|
|
"operationId": "login-normal",
|
|
"externalDocs": {
|
|
"description": "HMAC 계산",
|
|
"url": "https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/utils.ts#L62-L66"
|
|
},
|
|
"requestBody": {
|
|
"content": {
|
|
"application/x-www-form-urlencoded": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"password"
|
|
],
|
|
"properties": {
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"totpToken": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "작업 성공"
|
|
},
|
|
"401": {
|
|
"description": "비밀번호 또는 일회용 인증 번호 불일치"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"Attribute": {
|
|
"type": "object",
|
|
"properties": {
|
|
"attributeId": {
|
|
"type": "string",
|
|
"example": "4G1DPrI58PAb"
|
|
},
|
|
"noteId": {
|
|
"$ref": "#/components/schemas/NoteId"
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"enum": [
|
|
"label",
|
|
"relation"
|
|
]
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"example": "internalLink"
|
|
},
|
|
"value": {
|
|
"type": "string",
|
|
"example": "hA8aHSpTRdZ6",
|
|
"description": "type이 \"relation\"이면 노트 ID입니다. 그 외에는 속성 내용입니다."
|
|
},
|
|
"position": {
|
|
"type": "integer",
|
|
"example": 20
|
|
},
|
|
"isInheritable": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"Blob": {
|
|
"type": "object",
|
|
"properties": {
|
|
"blobId": {
|
|
"type": "string",
|
|
"example": "8iqMIB8eiY1tPYmElfjm"
|
|
},
|
|
"content": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"description": "텍스트가 아니면 `null`입니다."
|
|
},
|
|
"contentLength": {
|
|
"type": "integer"
|
|
},
|
|
"dateModified": {
|
|
"$ref": "#/components/schemas/DateTime"
|
|
},
|
|
"utcDateModified": {
|
|
"$ref": "#/components/schemas/UtcDateTime"
|
|
}
|
|
}
|
|
},
|
|
"Branch": {
|
|
"type": "object",
|
|
"required": [
|
|
"branchId",
|
|
"noteId",
|
|
"parentNoteId",
|
|
"notePosition"
|
|
],
|
|
"properties": {
|
|
"branchId": {
|
|
"$ref": "#/components/schemas/BranchId"
|
|
},
|
|
"noteId": {
|
|
"$ref": "#/components/schemas/NoteId"
|
|
},
|
|
"parentNoteId": {
|
|
"$ref": "#/components/schemas/NoteId"
|
|
},
|
|
"notePosition": {
|
|
"type": "integer",
|
|
"example": 20
|
|
},
|
|
"prefix": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"isExpanded": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"BranchId": {
|
|
"type": "string",
|
|
"example": "WUjhaGp4EKah_ur11rSfHkzeV",
|
|
"description": "`{parentNoteId}_{noteId}`와 같습니다."
|
|
},
|
|
"DateTime": {
|
|
"type": "string",
|
|
"example": "2025-02-14 08:19:59.203+0100"
|
|
},
|
|
"EntityChange": {
|
|
"type": "object",
|
|
"properties": {
|
|
"entityChange": {
|
|
"type": "object",
|
|
"properties": {
|
|
"entityName": {
|
|
"type": "string",
|
|
"example": "notes",
|
|
"description": "이 엔터티의 데이터베이스 테이블"
|
|
},
|
|
"changeId": {
|
|
"type": "string",
|
|
"example": "changeId9630",
|
|
"description": "`entity_changes` 테이블에서 참조하는 ID"
|
|
}
|
|
}
|
|
},
|
|
"entity": {
|
|
"type": "object",
|
|
"description": "인코딩한 엔터티 데이터. 데이터베이스의 각 열에 대응하는 속성이 들어 있는 객체입니다."
|
|
}
|
|
}
|
|
},
|
|
"Note": {
|
|
"type": "object",
|
|
"required": [
|
|
"noteId",
|
|
"title",
|
|
"isProtected",
|
|
"type",
|
|
"mime",
|
|
"blobId"
|
|
],
|
|
"properties": {
|
|
"noteId": {
|
|
"$ref": "#/components/schemas/NoteId"
|
|
},
|
|
"title": {
|
|
"type": "string"
|
|
},
|
|
"isProtected": {
|
|
"type": "boolean"
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"example": "text",
|
|
"enum": [
|
|
"text",
|
|
"code",
|
|
"render",
|
|
"file",
|
|
"image",
|
|
"search",
|
|
"relationMap",
|
|
"book",
|
|
"noteMap",
|
|
"mermaid",
|
|
"canvas",
|
|
"webView",
|
|
"launcher",
|
|
"doc",
|
|
"contentWidget",
|
|
"mindMap",
|
|
"geoMap"
|
|
],
|
|
"description": "[참고 목록](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/note_types.ts)"
|
|
},
|
|
"mime": {
|
|
"type": "string",
|
|
"example": "text/html"
|
|
},
|
|
"blobId": {
|
|
"type": "string",
|
|
"example": "z4PhNX7vuL3xVChQ1m2A"
|
|
}
|
|
}
|
|
},
|
|
"NoteId": {
|
|
"type": "string",
|
|
"example": "ur11rSfHkzeV",
|
|
"description": "12자리 노트 ID. 특수 값은 \"none\"과 \"root\"입니다."
|
|
},
|
|
"Timestamps": {
|
|
"type": "object",
|
|
"properties": {
|
|
"dateCreated": {
|
|
"$ref": "#/components/schemas/DateTime"
|
|
},
|
|
"dateModified": {
|
|
"$ref": "#/components/schemas/DateTime"
|
|
},
|
|
"utcDateCreated": {
|
|
"$ref": "#/components/schemas/UtcDateTime"
|
|
},
|
|
"utcDateModified": {
|
|
"$ref": "#/components/schemas/UtcDateTime"
|
|
}
|
|
}
|
|
},
|
|
"UtcDateTime": {
|
|
"type": "string",
|
|
"example": "2025-02-13T07:42:47.698Z",
|
|
"description": "`new Date().toISOString().replace('T', ' ')`의 결과"
|
|
}
|
|
},
|
|
"securitySchemes": {
|
|
"user-password": {
|
|
"type": "apiKey",
|
|
"name": "trilium-cred",
|
|
"in": "header",
|
|
"description": "`user:password` 형식의 사용자 이름과 비밀번호"
|
|
},
|
|
"session": {
|
|
"type": "apiKey",
|
|
"in": "cookie",
|
|
"name": "trilium.sid"
|
|
}
|
|
}
|
|
},
|
|
"tags": [
|
|
{
|
|
"name": "auth",
|
|
"description": "인증"
|
|
},
|
|
{
|
|
"name": "sync",
|
|
"description": "동기화"
|
|
},
|
|
{
|
|
"name": "data"
|
|
}
|
|
]
|
|
} |