http://localhost:3000application/jsonPOST /auth/register
Content-Type: application/json
{
"username": "string",
"password": "string"
}
レスポンス:
{
"message": "ユーザーが正常に作成されました",
"user": {
"id": "string",
"username": "string",
"isAdmin": false
}
}
POST /auth/login
Content-Type: application/json
{
"username": "string",
"password": "string"
}
レスポンス:
{
"access_token": "jwt_token_string",
"user": {
"id": "string",
"username": "string",
"isAdmin": false
}
}
POST /auth/change-password
Authorization: Bearer <token>
Content-Type: application/json
{
"currentPassword": "string",
"newPassword": "string"
}
GET /model-configs
Authorization: Bearer <token>
レスポンス:
[
{
"id": "string",
"name": "string",
"provider": "openai|gemini",
"modelId": "string",
"baseUrl": "string",
"type": "llm|embedding|rerank",
"supportsVision": boolean
}
]
POST /model-configs
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "string",
"provider": "openai|gemini",
"modelId": "string",
"baseUrl": "string",
"apiKey": "string",
"type": "llm|embedding|rerank",
"supportsVision": boolean
}
PUT /model-configs/:id
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "string",
"apiKey": "string",
// ... その他のフィールド
}
DELETE /model-configs/:id
Authorization: Bearer <token>
POST /upload
Authorization: Bearer <token>
Content-Type: multipart/form-data
{
"file": File,
"chunkSize": number,
"chunkOverlap": number,
"embeddingModelId": "string",
"mode": "fast|precise" // 処理モード
}
レスポンス:
{
"id": "string",
"name": "string",
"originalName": "string",
"size": number,
"mimetype": "string",
"status": "pending|indexing|completed|failed"
}
GET /knowledge-bases
Authorization: Bearer <token>
レスポンス:
[
{
"id": "string",
"name": "string",
"originalName": "string",
"size": number,
"mimetype": "string",
"status": "pending|indexing|completed|failed",
"createdAt": "datetime"
}
]
DELETE /knowledge-bases/:id
Authorization: Bearer <token>
DELETE /knowledge-bases/clear
Authorization: Bearer <token>
POST /chat/stream
Authorization: Bearer <token>
Content-Type: application/json
{
"message": "string",
"history": [
{
"role": "user|assistant",
"content": "string"
}
],
"userLanguage": "zh|en|ja"
}
レスポンス: Server-Sent Events (SSE)
data: {"type": "content", "data": "ナレッジベースを検索中..."}
data: {"type": "content", "data": "関連情報が見つかりました..."}
data: {"type": "content", "data": "回答内容の断片"}
data: {"type": "sources", "data": [
{
"fileName": "string",
"content": "string",
"score": number,
"chunkIndex": number
}
]}
data: [DONE]
GET /user-settings
Authorization: Bearer <token>
レスポンス:
{
"selectedLLMId": "string",
"selectedEmbeddingId": "string",
"selectedRerankId": "string",
"temperature": number,
"maxTokens": number,
"topK": number,
"enableRerank": boolean,
"scoreThreshold": number,
"similarityThreshold": number,
"enableFullTextSearch": boolean,
"language": "zh|en|ja"
}
PUT /user-settings
Authorization: Bearer <token>
Content-Type: application/json
{
"selectedLLMId": "string",
"temperature": number,
"maxTokens": number,
// ... その他の設定フィールド
}
GET /api/vision/recommend-mode?file=xxx&size=xxx
Authorization: Bearer <token>
レスポンス:
{
"recommendedMode": "precise",
"reason": "ファイルサイズが大きいため、高精度モードを推奨します",
"estimatedCost": 0.5,
"estimatedTime": 60,
"warnings": ["処理時間が長くなる可能性があります", "API 利用料が発生します"]
}
POST /libreoffice/convert
Content-Type: multipart/form-data
{
"file": File
}
レスポンス:
{
"pdf_path": "/uploads/document.pdf",
"converted": true,
"original": "document.docx",
"file_size": 102400
}
GET /libreoffice/health
レスポンス:
{
"status": "healthy",
"service": "libreoffice-converter",
"version": "1.0.0",
"uptime": 3600.5
}
GET /users
Authorization: Bearer <admin_token>
POST /users
Authorization: Bearer <admin_token>
Content-Type: application/json
{
"username": "string",
"password": "string",
"isAdmin": boolean
}
DELETE /users/:id
Authorization: Bearer <admin_token>
{
"statusCode": number,
"message": "string",
"error": "string"
}
200 - 成功201 - 作成成功400 - リクエストパラメータの不正401 - 認証エラー / トークン無効403 - 権限不足404 - リソースが見つかりません409 - リソースの競合500 - サーバー内部エラー// ログイン
const loginResponse = await fetch('/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'user',
password: 'password'
})
});
const { access_token } = await loginResponse.json();
// ファイル一覧の取得
const filesResponse = await fetch('/knowledge-bases', {
headers: {
'Authorization': `Bearer ${access_token}`
}
});
const files = await filesResponse.json();
// ストリーミングチャット
const chatResponse = await fetch('/chat/stream', {
method: 'POST',
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
message: 'こんにちは',
history: [],
userLanguage: 'ja'
})
});
const reader = chatResponse.body.getReader();
// SSE ストリームの処理...