-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b15b66c
commit e84f088
Showing
4 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
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,81 @@ | ||
{ | ||
"type": "page", | ||
"title": "渠道管理", | ||
"remark": null, | ||
"name": "page-provider", | ||
"body": [ | ||
{ | ||
"type": "crud", | ||
"syncLocation": false, | ||
"api": { | ||
"method": "get", | ||
"url": "/admin/provider", | ||
"adaptor": "const uniqueProviders = [...new Set(payload.items.map(item => item.provider))]; const uniqueNames = [...new Set(payload.items.map(item => item.name))]; const uniqueOriginalModels = [...new Set(payload.items.map(item => item.original_model))]; const uniqueMappedModels = [...new Set(payload.items.map(item => item.mapped_model))]; return {\n ...payload,\n providerOptions: uniqueProviders.map(provider => ({\n label: provider,\n value: provider\n })),\n nameOptions: uniqueNames.map(name => ({\n label: name,\n value: name\n })),\n originalModelOptions: uniqueOriginalModels.map(model => ({\n label: model,\n value: model\n })),\n mappedModelOptions: uniqueMappedModels.map(model => ({\n label: model,\n value: model\n }))\n}" | ||
}, | ||
"perPage": 100, | ||
"loadDataOnce": true, | ||
"columns": [ | ||
{ | ||
"name": "provider", | ||
"label": "提供商", | ||
"type": "text", | ||
"searchable": { | ||
"type": "select", | ||
"name": "provider", | ||
"label": "提供商", | ||
"placeholder": "选择提供商", | ||
"source": "${providerOptions}" | ||
} | ||
}, | ||
{ | ||
"name": "name", | ||
"label": "名称", | ||
"type": "text", | ||
"searchable": { | ||
"type": "select", | ||
"name": "name", | ||
"label": "名称", | ||
"placeholder": "选择名称", | ||
"source": "${nameOptions}" | ||
} | ||
}, | ||
{ | ||
"name": "original_model", | ||
"label": "原始模型", | ||
"type": "text", | ||
"searchable": { | ||
"type": "select", | ||
"name": "original_model", | ||
"label": "原始模型", | ||
"placeholder": "选择原始模型", | ||
"source": "${originalModelOptions}" | ||
} | ||
}, | ||
{ | ||
"name": "mapped_model", | ||
"label": "映射模型", | ||
"type": "text", | ||
"searchable": { | ||
"type": "select", | ||
"name": "mapped_model", | ||
"label": "映射模型", | ||
"placeholder": "选择映射模型", | ||
"source": "${mappedModelOptions}" | ||
} | ||
}, | ||
{ | ||
"name": "base_url", | ||
"label": "基础URL", | ||
"type": "text", | ||
"searchable": true | ||
}, | ||
{ | ||
"name": "weight", | ||
"label": "权重", | ||
"type": "number", | ||
"sortable": true | ||
} | ||
] | ||
} | ||
] | ||
} |
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
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,39 @@ | ||
from fastapi import APIRouter, HTTPException, Query, Body, Path | ||
from fastapi.responses import JSONResponse | ||
from typing import List | ||
from app.db.reqLogs import RequestLogger | ||
from pydantic import BaseModel | ||
import datetime | ||
|
||
router = APIRouter() | ||
|
||
|
||
from app.api_data import db, get_db | ||
|
||
|
||
@router.get("/provider") | ||
async def index( | ||
): | ||
pass | ||
db = get_db() | ||
data = db.get_all_provider() | ||
return JSONResponse({ | ||
"items": data, | ||
"total": 0 | ||
}) | ||
|
||
@router.post("/provider") | ||
async def store(): | ||
pass | ||
|
||
@router.get("/provider/{log_id}") | ||
async def show(): | ||
pass | ||
|
||
@router.put("/provider/{log_id}") | ||
async def update(): | ||
pass | ||
|
||
@router.delete("/provider/{log_id}") | ||
async def destroy(): | ||
pass |
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