-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from difizen/ximo_dev_0712
feat(api): add ApiTool
- Loading branch information
Showing
29 changed files
with
789 additions
and
55 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
api/alembic/versions/df31d751e3d7_update_plugin_api_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""update plugin api table | ||
Revision ID: df31d751e3d7 | ||
Revises: a7a038514b7c | ||
Create Date: 2024-07-17 09:25:05.071105 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'df31d751e3d7' | ||
down_revision: Union[str, None] = 'a7a038514b7c' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('plugin_api', sa.Column( | ||
'server_url', sa.String(length=255), nullable=True)) | ||
op.add_column('plugin_api', sa.Column( | ||
'method', sa.String(length=255), nullable=True)) | ||
op.add_column('plugin_api', sa.Column( | ||
'summary', sa.String(length=255), nullable=True)) | ||
op.add_column('plugin_api', sa.Column( | ||
'parameters', sa.JSON(), nullable=True)) | ||
op.add_column('plugin_api', sa.Column( | ||
'operation_id', sa.String(length=255), nullable=True)) | ||
op.alter_column('plugin_api', 'openapi_desc', | ||
existing_type=sa.TEXT(), | ||
type_=sa.JSON(), | ||
existing_nullable=True) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column('plugin_api', 'openapi_desc', | ||
existing_type=sa.JSON(), | ||
type_=sa.TEXT(), | ||
existing_nullable=True) | ||
op.drop_column('plugin_api', 'operation_id') | ||
op.drop_column('plugin_api', 'parameters') | ||
op.drop_column('plugin_api', 'summary') | ||
op.drop_column('plugin_api', 'method') | ||
op.drop_column('plugin_api', 'server_url') | ||
# ### end Alembic commands ### |
34 changes: 34 additions & 0 deletions
34
api/alembic/versions/f54e1fc0bd90_update_plugin_config_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""update plugin config table | ||
Revision ID: f54e1fc0bd90 | ||
Revises: df31d751e3d7 | ||
Create Date: 2024-07-21 14:41:06.251765 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'f54e1fc0bd90' | ||
down_revision: Union[str, None] = 'df31d751e3d7' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('plugin_config', sa.Column('apis', sa.JSON(), nullable=True)) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('plugin_config', 'apis') | ||
op.alter_column('messages', 'message_type', | ||
existing_type=sa.Enum('MARKDOWN', 'TEXT', name='messagetype'), | ||
type_=sa.VARCHAR(length=50), | ||
existing_nullable=False) | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
defaultPluginOpenapiDesc: str = """ | ||
info: | ||
description: arxiv查找论文 | ||
title: arxiv_app | ||
version: v1 | ||
openapi: 3.0.1 | ||
paths: | ||
/search: | ||
get: | ||
operationId: search | ||
parameters: | ||
- description: 输入搜索关键词,必须是英文 | ||
in: query | ||
name: search_query | ||
required: true | ||
schema: | ||
type: string | ||
- description: 搜索数量 | ||
in: query | ||
name: count | ||
schema: | ||
type: integer | ||
- description: 可以是1:降序2:升序 | ||
in: query | ||
name: sort_order | ||
schema: | ||
type: integer | ||
- description: 可以是1:相关性2.lastUpdateDate3.submittedDate | ||
in: query | ||
name: sort_by | ||
schema: | ||
type: integer | ||
- description: 报告编号过滤器,用于获取报告编号中包含给定关键字的结果 | ||
in: query | ||
name: report_number | ||
schema: | ||
type: string | ||
- description: 主题类别过滤器,用于获取主题类别中包含给定关键字的结果。 | ||
in: query | ||
name: subject_category | ||
schema: | ||
type: string | ||
- description: 标题过滤器,用于获取标题包含给定关键字的结果 | ||
in: query | ||
name: title | ||
schema: | ||
type: string | ||
- description: 摘要过滤器,用于获取摘要中包含给定关键字的结果 | ||
in: query | ||
name: abstract | ||
schema: | ||
type: string | ||
- description: 作者过滤器,用于获取包含给定关键字的作者的结果 | ||
in: query | ||
name: author | ||
schema: | ||
type: string | ||
- description: 评论过滤器,用于获取评论中包含给定关键字的结果 | ||
in: query | ||
name: comment | ||
schema: | ||
type: string | ||
- description: 期刊参考过滤器,用于获取期刊参考中包含给定关键字的结果 | ||
in: query | ||
name: journal_reference | ||
schema: | ||
type: string | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
responses: | ||
"200": | ||
content: | ||
application/json: | ||
schema: | ||
properties: | ||
items: | ||
items: | ||
properties: | ||
authors: | ||
description: 作者列表 | ||
items: | ||
description: 作者 | ||
type: string | ||
type: array | ||
entry_id: | ||
description: https://arxiv.org/abs/{id} 链接 | ||
type: string | ||
pdf_url: | ||
description: pdf 下载链接 | ||
type: string | ||
published: | ||
description: 发表时间 | ||
type: string | ||
summary: | ||
description: 摘要 | ||
type: string | ||
title: | ||
description: 标题 | ||
type: string | ||
type: object | ||
type: array | ||
total: | ||
description: 结果数目 | ||
type: integer | ||
type: object | ||
description: new desc | ||
default: | ||
description: "" | ||
summary: search | ||
servers: | ||
- url: http://env-00jxgx8y5a87.dev-hz.cloudbasefunction.cn | ||
""" |
Oops, something went wrong.