feat: Implement knowledge import feature for characters

- Added KnowledgeImport page for importing character knowledge from URLs.
- Integrated URL validation and error handling for unsupported websites.
- Created API endpoints for importing content from URLs and retrieving character knowledge.
- Enhanced VectorStoreService with logging and error handling for vector memory storage.
- Updated frontend to display knowledge sources and manage them effectively.
- Added support for fetching recent character knowledge as a fallback in similarity searches.
- Updated OpenAPI documentation to reflect new import functionality.
This commit is contained in:
GW_MC
2026-02-24 14:29:26 +00:00
parent 8714d6bd22
commit e033d67ec1
30 changed files with 2018 additions and 204 deletions

View File

@@ -902,6 +902,59 @@
"import"
]
}
},
"/api/import/characters/{characterId}/url": {
"post": {
"operationId": "ImportController_importFromUrl",
"parameters": [
{
"name": "characterId",
"required": true,
"in": "path",
"description": "Character ID",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImportUrlDto"
}
}
}
},
"responses": {
"201": {
"description": "URL content is being imported and processed",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadResponseDto"
}
}
}
},
"400": {
"description": "Invalid URL or unsupported website"
},
"401": {
"description": "Unauthorized"
}
},
"security": [
{
"bearer": []
}
],
"summary": "Import content from URL for character knowledge",
"tags": [
"import"
]
}
}
},
"info": {
@@ -1462,6 +1515,36 @@
"userMessage",
"assistantMessage"
]
},
"ImportUrlDto": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "URL to import",
"example": "https://sakurazaka46.com/s/s46/diary/detail/68008"
}
},
"required": [
"url"
]
},
"UploadResponseDto": {
"type": "object",
"properties": {
"knowledgeId": {
"type": "string",
"description": "Knowledge ID"
},
"message": {
"type": "string",
"description": "Status message"
}
},
"required": [
"knowledgeId",
"message"
]
}
}
}