Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions aperag/api/components/schemas/auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ user:
registration_source:
type: string
description: The registration source of the user (local, google, github, etc.)
department_id:
type: string
description: The department ID the user belongs to
nullable: true

userList:
type: object
Expand All @@ -127,3 +131,49 @@ changePassword:
new_password:
type: string
description: The new password of the user

department:
type: object
properties:
id:
type: string
description: The ID of the department
parent_id:
type: string
description: The parent department ID, -1 for root department
name:
type: string
description: The name of the department
status:
type: integer
description: The status of the department (0=inactive, 1=active)
enum: [0, 1]
group_path:
type: string
description: The hierarchical path of the department
tenant_id:
type: string
description: The tenant ID this department belongs to
created_at:
type: string
description: The date and time the department was created
updated_at:
type: string
description: The date and time the department was last updated
children:
type: array
items:
$ref: '#/department'
description: Child departments (only present in hierarchical mode)
nullable: true

departmentList:
type: object
description: A list of departments
properties:
items:
type: array
items:
$ref: '#/department'
pageResult:
$ref: './common.yaml#/pageResult'
84 changes: 72 additions & 12 deletions aperag/api/components/schemas/bot.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
agentConfig:
type: object
properties:
completion:
$ref: './model.yaml#/modelSpec'
system_prompt_template:
type: string
query_prompt_template:
type: string
collections:
type: array
items:
$ref: './collection.yaml#/collection'

botConfig:
type: object
properties:
agent:
type: object
properties:
completion:
$ref: './model.yaml#/modelSpec'
system_prompt_template:
type: string
query_prompt_template:
type: string
collections:
type: array
items:
$ref: './collection.yaml#/collection'
$ref: '#/agentConfig'
flow:
$ref: './flow.yaml#/components/schemas/WorkflowDefinition'

Expand Down Expand Up @@ -92,3 +95,60 @@ debugFlowRequest:
type: string
required:
- query

botPublishRequest:
type: object
properties:
group_ids:
type: array
items:
type: string
description: List of department IDs to publish to, or ["*"] for global publishing
example: ["*", "dp_1", "dp_2"]
required:
- group_ids

botMarketplace:
type: object
properties:
id:
type: string
description: Marketplace entry ID
bot_id:
type: string
description: Bot ID
group_id:
type: string
description: Department ID or "*" for global
status:
type: string
enum: [DRAFT, PUBLISHED]
description: Publishing status
published_at:
type: string
format: date-time
description: When the bot was published

marketplaceBotList:
type: object
description: List of marketplace bots accessible to user
properties:
items:
type: array
items:
allOf:
- $ref: '#/bot'
- type: object
properties:
group_id:
type: string
description: The department this bot is published to
published_at:
type: string
format: date-time
description: When the bot was published
owner_username:
type: string
description: Username of the bot owner
pageResult:
$ref: './common.yaml#/pageResult'
116 changes: 115 additions & 1 deletion aperag/api/components/schemas/marketplace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,118 @@ SharingStatusResponse:
nullable: true
description: Publication time, null when not published
required:
- is_published
- is_published

BotMarketplaceStatusEnum:
type: string
enum:
- DRAFT
- PUBLISHED
description: Bot marketplace sharing status


BotSharingStatusResponse:
type: object
description: Simple sharing status response
properties:
is_published:
type: boolean
description: Whether published to marketplace
group_ids:
type: array
items:
type: string
description: List of department IDs where the bot is published
is_global:
type: boolean
description: Whether the bot is published globally
required:
- is_published

SharedBotConfig:
type: object
description: Configuration settings for shared bot (read-only version)
properties:
agent:
$ref: './bot.yaml#/agentConfig'
flow:
$ref: './flow.yaml#/components/schemas/WorkflowDefinition'

SharedBot:
type: object
description: Shared bot information for marketplace users
properties:
id:
type: string
description: Bot ID
title:
type: string
description: Bot title
description:
type: string
nullable: true
description: Bot description
type:
type: string
enum:
- knowledge
- common
- agent
description: Bot type
owner_user_id:
type: string
description: Original owner user ID
owner_username:
type: string
nullable: true
description: Original owner username
subscription_id:
type: string
nullable: true
description: Subscription record ID (has value if subscribed, null if not subscribed)
gmt_subscribed:
type: string
format: date-time
nullable: true
description: Subscription time (only has value when subscribed)
config:
$ref: '#/SharedBotConfig'
description: Bot configuration settings (read-only)
is_subscribed:
type: boolean
description: Whether current user has subscribed to this bot
is_owner:
type: boolean
description: Whether current user is the owner of this bot
required:
- id
- title
- type
- owner_user_id
- config
- is_subscribed
- is_owner

SharedBotList:
type: object
description: Shared bot list response
properties:
items:
type: array
items:
$ref: '#/SharedBot'
description: List of shared bots
total:
type: integer
description: Total count (for pagination)
page:
type: integer
description: Current page number
page_size:
type: integer
description: Page size
required:
- items
- total
- page
- page_size
10 changes: 10 additions & 0 deletions aperag/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ paths:
$ref: './paths/flow.yaml#/flow'
/bots/{bot_id}/flow/debug:
$ref: './paths/bots.yaml#/debugFlow'
/bots/{bot_id}/sharing:
$ref: './paths/bots.yaml#/botSharing'

# chats
/bots/{bot_id}/chats:
Expand Down Expand Up @@ -116,6 +118,12 @@ paths:
/marketplace/collections/{collection_id}/graph:
$ref: './paths/marketplace.yaml#/marketplaceCollectionGraph'

# Bot marketplace
/marketplace/bots:
$ref: './paths/marketplace.yaml#/marketplaceBots'
/marketplace/bots/{bot_id}:
$ref: './paths/marketplace.yaml#/marketplaceBot'

# object storage sync
/collections/{collection_id}/sync:
$ref: './paths/collections.yaml#/sync_object_storage'
Expand Down Expand Up @@ -183,6 +191,8 @@ paths:
$ref: './paths/auth.yaml#/changePassword'
/users/{user_id}:
$ref: './paths/auth.yaml#/deleteUser'
/departments:
$ref: './paths/auth.yaml#/departments'

# quotas
/quotas:
Expand Down
32 changes: 32 additions & 0 deletions aperag/api/paths/auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,35 @@ user:
application/json:
schema:
$ref: '../components/schemas/common.yaml#/failResponse'

departments:
get:
summary: Get department organization structure
description: Get department organization structure information
parameters:
- name: tenant_id
in: query
required: false
schema:
type: string
description: Optional tenant ID to filter departments
- name: hierarchical
in: query
required: false
schema:
type: boolean
default: true
description: If true, returns departments in hierarchical structure with children
responses:
'200':
description: Departments fetched successfully
content:
application/json:
schema:
$ref: '../components/schemas/auth.yaml#/departmentList'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '../components/schemas/common.yaml#/failResponse'
Loading
Loading