Knowledge Base GPT
Knowledge Base GPT · GPT Actions
Sapientor API
GET /api/gpt/authoriseAuthorise user and retrieves user information based on a provided token.GET /api/gpt/knowledge/{user_id}/basicRetrieves the last 10 knowledge summaries for a specified user.GET /api/gpt/knowledge/{user_id}/inputProcesses input to retrieve relevant documents for a specified user.GET /api/gpt/parse-linkParses a given link and performs data extraction and vector storage.GET /api/gpt/parse-textParses given text, generates a title, and stores the text with its metadata.
原始 API 定义
{
"openapi": "3.0.0",
"info": {
"title": "Sapientor API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://sapientor.net"
}
],
"paths": {
"/api/gpt/authorise": {
"get": {
"operationId": "authorise",
"summary": "Authorise user and retrieves user information based on a provided token.",
"parameters": [
{
"in": "query",
"name": "token",
"required": true,
"schema": {
"type": "string"
},
"description": "User authentication token."
}
],
"responses": {
"200": {
"description": "Successfully retrieved user information.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "User ID."
},
"email": {
"type": "string",
"format": "email",
"description": "User email."
}
}
}
}
}
},
"400": {
"description": "Missing or invalid token.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized access.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/api/gpt/knowledge/{user_id}/basic": {
"get": {
"operationId": "getBasicKnowledgeSummaries",
"summary": "Retrieves the last 10 knowledge summaries for a specified user.",
"parameters": [
{
"in": "path",
"name": "user_id",
"required": true,
"schema": {
"type": "string"
},
"description": "User identifier"
}
],
"responses": {
"200": {
"description": "Successfully retrieved the last 10 summaries.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The content of the summary."
},
"url": {
"type": "string",
"format": "uri",
"description": "The URL associated with the summary."
},
"title": {
"type": "string",
"description": "The title of the summary."
}
}
}
}
}
}
},
"400": {
"description": "Missing user_id in the request.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized access.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"500": {
"description": "Database error or retrieval failure.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/api/gpt/knowledge/{user_id}/input": {
"get": {
"summary": "Processes input to retrieve relevant documents for a specified user.",
"operationId": "getRelevantDocumentsForInput",
"parameters": [
{
"in": "path",
"name": "user_id",
"required": true,
"schema": {
"type": "string"
},
"description": "User identifier"
},
{
"in": "query",
"name": "input",
"required": true,
"schema": {
"type": "string"
},
"description": "Input text to process and find relevant information."
}
],
"responses": {
"200": {
"description": "Successfully processed input and returned relevant information.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result": {
"type": "string",
"description": "The result of processing the input."
}
}
}
}
}
},
"400": {
"description": "Input validation error. Either 'input' or 'user_id' is missing.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized access. Invalid or missing API key.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/api/gpt/parse-link": {
"get": {
"operationId": "parseLink",
"summary": "Parses a given link and performs data extraction and vector storage.",
"parameters": [
{
"in": "query",
"name": "url",
"required": true,
"schema": {
"type": "string"
},
"description": "URL to parse."
},
{
"in": "query",
"name": "user_id",
"required": true,
"schema": {
"type": "string"
},
"description": "User ID for associating the parsing process."
}
],
"responses": {
"200": {
"description": "Successfully processed the request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ids": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of stored document IDs."
},
"success": {
"type": "boolean",
"description": "Indicates if the process was successful."
}
}
}
}
}
},
"400": {
"description": "Bad request - missing fields.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized access.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"500": {
"description": "Internal Server Error.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/api/gpt/parse-text": {
"get": {
"operationId": "parseText",
"summary": "Parses given text, generates a title, and stores the text with its metadata.",
"parameters": [
{
"in": "query",
"name": "text",
"required": true,
"schema": {
"type": "string"
},
"description": "Text to be parsed."
},
{
"in": "query",
"name": "user_id",
"required": true,
"schema": {
"type": "string"
},
"description": "User ID for associating the parsing process."
}
],
"responses": {
"200": {
"description": "Successfully processed the request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates if the process was successful."
}
}
}
}
}
},
"400": {
"description": "Bad request - missing fields.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized access.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"500": {
"description": "Internal Server Error.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message."
}
}
}
}
}
}