Merge branch 'feature/1.7-liujian' into 'main'
Revert "Auxiliary commit to revert individual files from da05525cbbf2510a2cbc37d7eed6bfb8248e448b" See merge request apipark/APIPark!291
@@ -56,7 +56,7 @@ body:
|
||||
label: Environment
|
||||
description: Share your environment details. Reports without proper environment details will likely be closed.
|
||||
value: |
|
||||
- APINTO Dashboard version:
|
||||
- ApiPark version:
|
||||
- Operating system (run `uname -a`):
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,99 +0,0 @@
|
||||
variables:
|
||||
PATH: /opt/go-1.23/go/bin/:/opt/node-1.22/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
|
||||
GOROOT: /opt/go-1.23/go
|
||||
GOPROXY: https://goproxy.cn
|
||||
VERSION: $CI_COMMIT_SHORT_SHA
|
||||
APP: apipark
|
||||
APP_PRE: ${APP}_${VERSION}
|
||||
BUILD_DIR: ${APP}-build
|
||||
DEPLOY_DESC: "DEV 环境"
|
||||
VIEW_ADDR: http://172.18.166.219:8288
|
||||
SAVE_DIR: /opt/${APP}
|
||||
NODE_OPTIONS: --max_old_space_size=8192
|
||||
APIPARK_OLLAMA_BASE: http://127.0.0.1:11434
|
||||
|
||||
stages:
|
||||
- notice
|
||||
- prefix
|
||||
- build
|
||||
- deploy
|
||||
- webhook
|
||||
|
||||
feishu-informer: # 飞书回调
|
||||
stage: notice
|
||||
variables:
|
||||
DIFF_URL: "$CI_MERGE_REQUEST_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_IID/diffs"
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE=="merge_request_event" && $CI_COMMIT_BRANCH =~ "main"
|
||||
script:
|
||||
- echo "merge request"
|
||||
- |
|
||||
curl -X POST -H "Content-Type: application/json" \
|
||||
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"项目:${CI_PROJECT_NAME}\\n提交人:${GITLAB_USER_NAME}\\n提交信息:${CI_MERGE_REQUEST_TITLE}\\n合并分支信息:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} -> ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}\\n差异性地址:${DIFF_URL}\\n请及时review代码\"}}" \
|
||||
https://open.feishu.cn/open-apis/bot/v2/hook/1c334752-2874-41a1-8f1b-3060f2d46b6c
|
||||
|
||||
prebuild:
|
||||
stage: prefix
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
script:
|
||||
- echo "prebuild"
|
||||
- chmod +x ./scripts/prefix.sh
|
||||
- ./scripts/prefix.sh
|
||||
|
||||
builder:
|
||||
stage: build
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
script:
|
||||
- set -e
|
||||
- |
|
||||
if [ ! -d "../artifacts" ]; then
|
||||
mkdir -p ../artifacts
|
||||
fi
|
||||
if [ -d "../artifacts/dist" ]; then
|
||||
cp -r ../artifacts/dist frontend/dist
|
||||
fi
|
||||
- |
|
||||
if [ -n "$(git diff --name-status HEAD~1 HEAD -- frontend)" ]; then
|
||||
./scripts/build.sh $BUILD_DIR ${VERSION} all ""
|
||||
else
|
||||
./scripts/build.sh $BUILD_DIR ${VERSION}
|
||||
fi
|
||||
if [ -d "frontend/dist" ]; then
|
||||
echo "copy frontend/dist to artifacts/dist"
|
||||
rm -fr ../artifacts/dist
|
||||
cp -r frontend/dist ../artifacts/dist
|
||||
fi
|
||||
cp $BUILD_DIR/${APP_PRE}_linux_amd64.tar.gz ${SAVE_DIR}
|
||||
|
||||
deployer:
|
||||
stage: deploy
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
variables:
|
||||
APIPARK_GUEST_MODE: allow
|
||||
APIPARK_GUEST_ID: dklejrfbhjqwdh
|
||||
script:
|
||||
- cd ${SAVE_DIR};mkdir -p ${APP_PRE};tar -zxvf ${APP_PRE}_linux_amd64.tar.gz -C ${APP_PRE};cd ${APP_PRE};./install.sh ${SAVE_DIR};./run.sh restart;cd ${SAVE_DIR} && ./clean.sh ${APP_PRE}
|
||||
when: on_success
|
||||
success:
|
||||
stage: webhook
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
script:
|
||||
- |
|
||||
curl -X POST -H "Content-Type: application/json" \
|
||||
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"最近一次提交:${CI_COMMIT_TITLE}\\n提交人:${GITLAB_USER_NAME}\\n项目:${CI_PROJECT_NAME}\\n环境:${DEPLOY_DESC}\\n更新部署完成.\\n访问地址:${VIEW_ADDR}\\n工作流地址:${CI_PIPELINE_URL}\"}}" \
|
||||
https://open.feishu.cn/open-apis/bot/v2/hook/c3672932-4dfa-4989-8023-0128bae59338
|
||||
when: on_success
|
||||
failure:
|
||||
stage: webhook
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
script:
|
||||
- |
|
||||
curl -X POST -H "Content-Type: application/json" \
|
||||
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"最近一次提交:${CI_COMMIT_TITLE}\\n提交人:${GITLAB_USER_NAME}\\n项目:${CI_PROJECT_NAME}\\n环境:${DEPLOY_DESC}\\n更新部署失败,请及时到gitlab上查看\\n工作流地址:${CI_PIPELINE_URL}\"}}" \
|
||||
https://open.feishu.cn/open-apis/bot/v2/hook/c3672932-4dfa-4989-8023-0128bae59338
|
||||
when: on_failure
|
||||
@@ -8,10 +8,11 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
client *api.Client
|
||||
client *api.Client
|
||||
ProviderLocal = "LocalModel"
|
||||
)
|
||||
|
||||
func ResetOllamaAddress(address string) error {
|
||||
func ResetLocalAddress(address string) error {
|
||||
u, err := url.Parse(address)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -19,3 +20,12 @@ func ResetOllamaAddress(address string) error {
|
||||
client = api.NewClient(u, http.DefaultClient)
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
LocalConfig = "{\n \"temperature\": \"\",\n \"top_p\": \"\",\n \"max_tokens\": \"\"\n}"
|
||||
LocalSvg = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="50" height="50" viewBox="0 0 50 50">
|
||||
<image id="椭圆_1_拷贝" data-name="椭圆 1 拷贝" x="5" y="4" width="42" height="38" xlink:href="data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAmCAYAAACyAQkgAAAGKUlEQVRYhZVYW8hWRRRdayklFhRqIRmCRQ+GhGVGFgZSPXSBEFKzHqKXKCNCNFAfkjIKRAokegiKCEq7QT0U1EMEvphYgZGaFYEkFH9o0EMX/WdiZs6cM7fz/fXB4dvnMjN71uy19p7h1g1/wRiLaQMYf0Xb+vvpaVTv/XM72MbgGmPso9MGtxuDJcbac8bgR2vwkbH2ZWPwk7GAdd9ai2hb14ezrfW2u8Z+EgGScP/BRmcz2AIo+v9oU/03s0m8QOJrko+IuFJyffI8EUspbCV5jMST7PqOYzG72N+P/Wb7QbuXbkICveVmJ9/awrpHJCytH8R9YulfvyNirW+i0J4mcSA0O1/kbsDOM8T24ItzzHZW/rPRkeKnAckU1RzB8I/y2WMS1qpDmN0qxD7c876/8H4biTtZodlNCGw6Hn+KAwUnWC99KxyIOSKfInMH/X3ieLqk3hZecm2zd+iWfIYQUDnQgNpgK0PV27dRWKAM+e5bFlf2jEtIbM6cbyHccFajJKpQzQh3XXSiiWp0QC1nuIPEoppQMQzai68CqVE7ItM5dYFGHOxRVLXscdIXitidTrAgXzMEVJGojWBHit7p06VkKSVbtkJxktmENpJY/X9CoNfRjFAqYjVlc+j0QB0mBaoVsSLZ/D9J7hUxq58UqhAZgsD3V5AgH3hYylymeFDCsYZktZJCU7IkLCfx8CiSQDejYGc6OhOhksuQ2DH524Jcbcl6msTFFQlRIMsuRstlrwnVRPUDCZ9W8paGQSpx9fK76xLJO1s5Vl6KgV7KzCTJSlbhCQln8wklEy8EvyRWN8YmkstYTqbIWmoxtI1qbndtjovYW6Na2z256nBwhc1ezYCqBgfbObslWXkG47MSplqESpWDCWFVr84akutS0CLrk5Ued5AFyuUg3fvfFbJNk3zNfoVctoK9h+Tc1vJjiNGiUaGjE2Qq2q9JOFzm/Jam1jHaT2yxiC3ZchfcmBDobYQbWcuIfNyVrD3aJbnKdJkU5v1zuVKQi8kUvF6eIpIjnRRloAq0E1QPinyjTahCRbLVyq65LgRUkYkJmcrc3MjZZbA3Mtg2in+UpR8bNW8Zu0nWWkc5chWsr7JGYmfEadYC1bL+IuK5FNVWpqokq85ae+n2Y3nFlmrVOEMn6mROwBcpft/S3/8kWQHZZSI2lYkoHdiZ95B4m8IJCb+JPCp3T9zd3q1WGexvV2+2MxyqZc+QzGPWbXXmx3ez3cfGCysXEvYtOvF1y2FsbDCfxFIJ6wEcALDRAqf63Wq6cx3sj4ONajeb2oEkdqjlzPCcsvNpsMsh2++ZSFxO4rDLEFXW0BDoodjlIb9/HyNU+O5PJWExKWuVDC9k0pWBy9kttcu170pYVOVYNYoK4jKJ+yjMGi20xZvGCDWmImUa765ZVF9L8D4SN5bOtWQrSX0rRWyv489PZo6IXfn2ZLxkzMrLtmStFnGXe/5Azq5BjjLJqhXB1ZFOii7q5cuzla5GvbZEsI1qraktmSTxkFv2FfGEgt0mhcyrbEcQd5wzdGIRToK4HbCbLfCDDOdC9opIouGICDXhbEqu/ogI6fFSYHj/fJVzdIF3zh8m2U4Buo7d+ZDCKV7s0PdkMubOEe1VID6xxCsiToE8Z2mXiLgV5BpLqzBoGCOeU6lju3Pf23m//nxKYbyFztEpAJcGNOmbDcgO9xHJ9BBMwfHXLbCTwMmGTD1vgasF7rGwd3gl6lCaKFndZPwkgkyecd98UW6mypqwVVlJnKbwoIsfkSfHKi4RRwMZsHNycV1krZyoXzm+vVoWAK2aMKusQkdbYrWUlYEtyfLlH5+JW46ZJKuRxve5Zx+C+LxyhmkFlbAzsPuzuFcqC+2mZA0ytFXCkVp3J5wNCN+KfFPdcd96EidytidI5kXJdyTv9yiNV+tjqJ0lsU7E1KTzgMQ+I8Id//wTyTxFcBWB97OaE4kdHH6PxCoSv85UaI+dDUh0xc4tFI4kqblVaB8hcTOJb1w7x/r4Ow3gXgI3AL4AWUlynmBPG+AQif0Ev/SMjG1SyRoYmmtjfz8crVvyuGhXgNhgxY2CvR7APAv8LOAYwH0Wdr+Ac75fY/EvLa1YGshjAE4AAAAASUVORK5CYII="/>
|
||||
</svg>
|
||||
|
||||
`
|
||||
)
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package ai_provider_local
|
||||
|
||||
var (
|
||||
OllamaConfig = "{\n \"mirostat\": 0,\n \"mirostat_eta\": 0.1,\n \"mirostat_tau\": 5.0,\n \"num_ctx\": 4096,\n \"repeat_last_n\":64,\n \"repeat_penalty\": 1.1,\n \"temperature\": 0.7,\n \"seed\": 42,\n \"num_predict\": 42,\n \"top_k\": 40,\n \"top_p\": 0.9,\n \"min_p\": 0.5\n}\n"
|
||||
OllamaSvg = `<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="4096.000000pt" height="4096.000000pt" viewBox="0 0 4096.000000 4096.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
|
||||
<g transform="translate(0.000000,4096.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M13179 36749 c-194 -28 -496 -139 -712 -260 -834 -469 -1516 -1636
|
||||
-1861 -3184 -82 -368 -134 -683 -181 -1100 -155 -1374 -116 -2661 120 -4025
|
||||
19 -107 36 -222 37 -254 l3 -59 -85 -70 c-507 -412 -773 -667 -1123 -1076
|
||||
-593 -691 -1055 -1493 -1378 -2390 -158 -436 -305 -1018 -369 -1458 -50 -343
|
||||
-76 -868 -67 -1348 8 -424 25 -600 93 -1004 160 -947 479 -1747 1023 -2559 67
|
||||
-101 125 -190 128 -198 3 -8 -20 -57 -52 -110 -361 -605 -691 -1540 -840
|
||||
-2379 -130 -732 -145 -929 -145 -1930 0 -984 14 -1180 131 -1840 145 -815 441
|
||||
-1680 760 -2221 72 -122 221 -353 275 -427 61 -84 66 -60 -98 -442 -319 -737
|
||||
-582 -1679 -708 -2530 -76 -520 -92 -755 -88 -1295 l3 -385 170 -128 c368
|
||||
-277 840 -604 1260 -872 192 -123 754 -464 823 -499 l33 -17 -30 53 c-143 256
|
||||
-255 663 -312 1134 -27 227 -37 770 -20 1045 55 860 262 1792 567 2546 95 235
|
||||
188 434 390 830 l194 382 0 238 c0 131 -5 258 -11 282 -15 68 -97 227 -159
|
||||
310 -32 42 -117 137 -189 211 -327 336 -485 590 -670 1079 -420 1109 -532
|
||||
2591 -300 3966 165 982 482 1778 902 2267 179 210 274 395 307 601 16 98 8
|
||||
331 -14 411 -56 201 -125 309 -385 603 -625 705 -989 1568 -1097 2598 -22 211
|
||||
-26 749 -6 960 103 1110 491 2126 1144 3000 768 1028 1809 1699 2963 1909 189
|
||||
35 330 46 581 46 248 0 407 -12 634 -46 272 -41 483 -32 634 28 153 60 312
|
||||
167 389 261 64 79 141 208 197 333 168 375 252 512 529 859 231 289 523 574
|
||||
816 795 633 477 1341 822 2052 999 403 100 458 106 1043 106 513 0 557 -3 780
|
||||
-46 928 -181 1875 -656 2640 -1325 171 -149 358 -355 570 -629 218 -280 285
|
||||
-390 419 -687 170 -378 274 -502 526 -623 235 -113 391 -125 815 -61 337 51
|
||||
628 58 915 21 968 -122 1847 -558 2609 -1295 886 -858 1491 -2062 1670 -3323
|
||||
44 -307 51 -416 51 -782 0 -268 -5 -389 -18 -515 -76 -697 -281 -1344 -601
|
||||
-1898 -170 -295 -327 -507 -576 -777 -258 -280 -368 -570 -331 -875 27 -220
|
||||
129 -428 317 -645 164 -190 270 -354 398 -615 337 -685 559 -1640 617 -2653
|
||||
15 -266 7 -870 -16 -1102 -81 -859 -254 -1586 -510 -2146 -150 -330 -269 -500
|
||||
-556 -799 -76 -80 -164 -178 -194 -219 -61 -80 -138 -232 -154 -302 -6 -24
|
||||
-11 -150 -11 -280 l0 -235 223 -445 c364 -724 509 -1097 672 -1734 121 -470
|
||||
193 -879 241 -1365 22 -222 30 -814 15 -1036 -36 -514 -138 -960 -296 -1291
|
||||
-30 -62 -50 -113 -46 -113 13 0 622 368 836 505 404 258 925 620 1280 887
|
||||
l150 113 3 355 c6 699 -34 1099 -188 1872 -154 772 -365 1445 -654 2091 -35
|
||||
78 -72 168 -82 200 -16 52 -17 61 -4 82 8 12 66 98 128 191 471 700 784 1566
|
||||
971 2689 95 572 105 768 98 1845 -6 789 -9 860 -52 1171 -103 737 -234 1310
|
||||
-420 1834 -125 354 -338 813 -549 1186 l-20 37 146 218 c319 479 532 894 714
|
||||
1396 185 509 320 1129 376 1728 16 179 16 1003 0 1250 -43 628 -153 1174 -366
|
||||
1815 -387 1165 -1000 2160 -1862 3020 -201 200 -331 317 -585 523 -103 83
|
||||
-189 158 -192 167 -9 21 5 122 52 389 197 1106 247 2336 145 3551 -163 1958
|
||||
-769 3565 -1637 4343 -144 130 -205 177 -344 269 -393 260 -825 367 -1298 323
|
||||
-1300 -123 -2362 -1541 -2860 -3819 -98 -448 -201 -1110 -224 -1434 -5 -71
|
||||
-14 -134 -20 -140 -14 -14 -51 4 -269 130 -1321 760 -2750 1079 -4137 922
|
||||
-939 -106 -1883 -422 -2736 -917 -197 -114 -258 -145 -274 -138 -15 5 -19 29
|
||||
-35 236 -23 291 -128 947 -215 1341 -211 957 -522 1775 -912 2399 -176 283
|
||||
-323 469 -543 691 -228 230 -396 360 -642 497 -114 63 -325 151 -422 176 -194
|
||||
51 -651 81 -827 55z m377 -1961 c67 -44 217 -198 286 -294 211 -295 383 -645
|
||||
554 -1123 189 -529 357 -1317 424 -1988 39 -394 59 -905 60 -1498 l0 -290
|
||||
-170 -251 -169 -251 -383 -6 c-600 -9 -872 -46 -1466 -197 -130 -33 -246 -60
|
||||
-258 -60 -33 0 -41 21 -63 176 -72 505 -105 1010 -105 1634 0 690 42 1222 139
|
||||
1793 185 1089 584 2047 976 2341 75 56 106 59 175 14z m14019 -13 c244 -174
|
||||
522 -666 720 -1275 338 -1039 471 -2402 369 -3780 -26 -359 -83 -831 -105
|
||||
-871 -5 -11 -19 -19 -31 -19 -12 0 -136 29 -277 64 -596 150 -851 184 -1454
|
||||
193 l-378 6 -170 251 -170 251 6 535 c9 882 40 1296 141 1890 154 902 418
|
||||
1698 748 2251 180 302 409 549 509 549 19 0 52 -16 92 -45z"/>
|
||||
<path d="M20150 22433 c-389 -29 -834 -89 -1069 -144 -413 -97 -967 -296
|
||||
-1322 -474 -1280 -645 -2169 -1692 -2469 -2910 -74 -300 -75 -307 -75 -820 0
|
||||
-487 2 -515 51 -735 99 -440 295 -889 550 -1256 341 -492 803 -911 1349 -1225
|
||||
621 -356 1384 -585 2131 -641 238 -18 2130 -18 2368 0 1169 87 2281 576 3042
|
||||
1336 374 374 627 760 829 1261 61 152 91 248 139 441 69 281 71 309 71 819 0
|
||||
513 -1 520 -75 822 -182 739 -580 1413 -1176 1993 -406 395 -826 686 -1368
|
||||
950 -661 322 -1372 512 -2091 560 -317 21 -762 32 -885 23z m836 -1333 c270
|
||||
-25 670 -109 961 -201 379 -121 793 -317 1099 -522 344 -229 767 -645 979
|
||||
-962 192 -287 321 -603 394 -970 66 -325 57 -531 -35 -900 -90 -355 -301 -716
|
||||
-603 -1028 -256 -264 -501 -434 -906 -627 -447 -213 -794 -305 -1335 -352
|
||||
-208 -18 -1977 -18 -2180 0 -543 49 -1161 251 -1615 527 -255 155 -563 423
|
||||
-743 647 -257 319 -394 631 -478 1088 -24 132 -26 161 -21 315 7 250 61 509
|
||||
163 782 130 352 389 722 755 1078 297 289 572 480 974 674 558 270 1171 433
|
||||
1740 461 192 10 700 4 851 -10z"/>
|
||||
<path d="M19620 19334 c-30 -8 -73 -26 -95 -39 -62 -36 -166 -152 -202 -225
|
||||
-89 -178 -81 -322 28 -508 56 -93 217 -247 354 -336 66 -43 137 -90 158 -104
|
||||
59 -39 72 -72 70 -177 -1 -49 -11 -142 -22 -205 -75 -411 -74 -408 -56 -476
|
||||
35 -131 161 -296 262 -345 41 -20 72 -24 252 -33 254 -12 330 -3 432 50 89 47
|
||||
169 132 199 210 46 123 43 299 -10 561 -33 165 -39 284 -16 336 18 42 66 86
|
||||
151 137 107 65 204 141 294 231 141 142 198 248 208 394 7 99 -6 164 -54 262
|
||||
-59 122 -193 236 -315 269 -73 19 -286 19 -363 -1 -80 -21 -201 -79 -328 -159
|
||||
-58 -36 -110 -66 -117 -66 -6 0 -60 29 -120 65 -151 89 -260 143 -327 160 -76
|
||||
20 -308 19 -383 -1z"/>
|
||||
<path d="M13766 22188 c-238 -24 -521 -166 -723 -361 -254 -246 -405 -551
|
||||
-458 -927 -19 -140 -19 -328 0 -418 67 -322 293 -638 578 -812 150 -91 358
|
||||
-151 582 -170 381 -31 677 88 965 386 156 162 237 282 330 491 116 261 130
|
||||
333 130 674 l0 227 -69 144 c-39 79 -93 178 -121 221 -66 99 -201 241 -303
|
||||
318 -99 75 -296 172 -402 198 -149 38 -327 48 -509 29z"/>
|
||||
<path d="M26855 22189 c-136 -14 -237 -44 -371 -109 -146 -71 -252 -149 -366
|
||||
-269 -109 -114 -173 -210 -259 -388 l-69 -142 0 -228 c0 -343 14 -414 130
|
||||
-676 96 -216 211 -380 382 -542 271 -259 556 -364 913 -335 140 12 322 51 423
|
||||
91 264 105 523 353 643 615 90 198 114 319 106 531 -12 317 -114 629 -291 888
|
||||
-68 100 -209 246 -304 315 -150 109 -351 203 -502 234 -96 20 -318 27 -435 15z"/>
|
||||
</g>
|
||||
</svg>
|
||||
`
|
||||
)
|
||||
@@ -31,12 +31,12 @@ provider_credential_schema:
|
||||
en_US: Enter your API Key
|
||||
- variable: anthropic_api_url
|
||||
label:
|
||||
en_US: API URL
|
||||
en_US: https://api.anthropic.com/v1/
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API URL
|
||||
en_US: Enter your API URL
|
||||
address: https://api.anthropic.com
|
||||
address: https://api.anthropic.com/v1/
|
||||
recommend: true
|
||||
sort: 2
|
||||
@@ -27,4 +27,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.baichuan-ai.com
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.baichuan-ai.com/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.baichuan-ai.com/v1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
provider: bailian
|
||||
label:
|
||||
zh_Hans: 阿里云百炼
|
||||
en_US: bailian
|
||||
en_US: BaiLian
|
||||
icon_small:
|
||||
en_US: icon_s_en.svg
|
||||
icon_large:
|
||||
@@ -21,7 +21,7 @@ configurate_methods:
|
||||
- customizable-model
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: dashscope_api_key
|
||||
- variable: api_key
|
||||
label:
|
||||
en_US: API Key
|
||||
type: secret-input
|
||||
@@ -29,4 +29,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://dashscope.aliyuncs.com
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||
@@ -87,6 +87,9 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
en_US: A model you have access to (e.g. amazon.titan-text-lite-v1) for validation.
|
||||
zh_Hans: 为了进行验证,请输入一个您可用的模型名称 (例如:amazon.titan-text-lite-v1)
|
||||
model_config:
|
||||
access_configuration_status: true
|
||||
access_configuration_demo: "{\"region\":\"\",\"model\":\"\"}"
|
||||
address: https://bedrock-runtime.amazonaws.com
|
||||
sort: 4
|
||||
recommend: true
|
||||
@@ -18,12 +18,20 @@ configurate_methods:
|
||||
- predefined-model
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: api_base
|
||||
- variable: api_key
|
||||
label:
|
||||
en_US: API URL
|
||||
type: text-input
|
||||
en_US: API Key
|
||||
type: secret-input
|
||||
required: true
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://open.bigmodel.cn/api/paas/v4/
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API URL
|
||||
en_US: Enter your API URL
|
||||
address: https://api.openai.com
|
||||
address: https://open.bigmodel.cn/api/paas/v4/
|
||||
@@ -32,4 +32,12 @@ provider_credential_schema:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
show_on: [ ]
|
||||
address: https://api.cohere.com
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.cohere.ai/compatibility/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.cohere.ai/compatibility/v1
|
||||
@@ -30,4 +30,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.deepseek.com
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.deepseek.com/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.deepseek.com/v1
|
||||
@@ -28,4 +28,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.fireworks.ai
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://generativelanguage.googleapis.com/v1beta/openai
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.fireworks.ai/inference/v1
|
||||
@@ -32,12 +32,12 @@ provider_credential_schema:
|
||||
- variable: google_api_base
|
||||
label:
|
||||
zh_Hans: API Base
|
||||
en_US: API Base
|
||||
en_US: https://generativelanguage.googleapis.com/v1beta/openai
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Base, 如:https://api.google.com
|
||||
en_US: Enter your API Base, e.g. https://api.google.com
|
||||
address: https://generativelanguage.googleapis.com
|
||||
address: https://generativelanguage.googleapis.com/v1beta/openai
|
||||
recommend: true
|
||||
sort: 3
|
||||
@@ -30,4 +30,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.groq.com
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.groq.com/openai/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.groq.com/openai/v1
|
||||
@@ -100,4 +100,22 @@ model_credential_schema:
|
||||
show_on:
|
||||
- variable: huggingfacehub_api_type
|
||||
value: inference_endpoints
|
||||
address: https://api-inference.huggingface.co
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: api_key
|
||||
label:
|
||||
en_US: API Key
|
||||
type: secret-input
|
||||
required: true
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://router.huggingface.co/hf-inference/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://router.huggingface.co/hf-inference/v1
|
||||
@@ -23,20 +23,36 @@ configurate_methods:
|
||||
- predefined-model
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: secret_id
|
||||
# - variable: secret_id
|
||||
# label:
|
||||
# en_US: Secret ID
|
||||
# type: secret-input
|
||||
# required: true
|
||||
# placeholder:
|
||||
# zh_Hans: 在此输入您的 Secret ID
|
||||
# en_US: Enter your Secret ID
|
||||
# - variable: secret_key
|
||||
# label:
|
||||
# en_US: Secret Key
|
||||
# type: secret-input
|
||||
# required: true
|
||||
# placeholder:
|
||||
# zh_Hans: 在此输入您的 Secret Key
|
||||
# en_US: Enter your Secret Key
|
||||
- variable: api_key
|
||||
label:
|
||||
en_US: Secret ID
|
||||
en_US: API Key
|
||||
type: secret-input
|
||||
required: true
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Secret ID
|
||||
en_US: Enter your Secret ID
|
||||
- variable: secret_key
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: Secret Key
|
||||
type: secret-input
|
||||
required: true
|
||||
en_US: https://api.hunyuan.cloud.tencent.com/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Secret Key
|
||||
en_US: Enter your Secret Key
|
||||
address: https://hunyuan.tencentcloudapi.com
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.hunyuan.cloud.tencent.com/v1
|
||||
@@ -1,11 +1 @@
|
||||
<svg width="80" height="22" viewBox="0 0 80 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Group">
|
||||
<path id="Vector" d="M25.1152 10.5768C25.1152 14.1739 27.4253 16.6819 30.6264 16.6819C33.8274 16.6819 36.1375 14.1739 36.1375 10.5768C36.1375 6.97973 33.8274 4.47168 30.6264 4.47168C27.4253 4.47168 25.1152 6.97973 25.1152 10.5768ZM34.0254 10.5768C34.0254 13.1509 32.6229 14.8174 30.6264 14.8174C28.6298 14.8174 27.2273 13.1509 27.2273 10.5768C27.2273 8.00275 28.6298 6.33622 30.6264 6.33622C32.6229 6.33622 34.0254 8.00275 34.0254 10.5768Z" fill="black"/>
|
||||
<path id="Vector_2" d="M42.0868 16.682C44.5124 16.682 45.8984 14.636 45.8984 12.1774C45.8984 9.71889 44.5124 7.67285 42.0868 7.67285C40.9648 7.67285 40.1398 8.11836 39.5953 8.76188V7.83786H37.6152V19.4706H39.5953V15.593C40.1398 16.2365 40.9648 16.682 42.0868 16.682ZM39.5458 11.9299C39.5458 10.2964 40.4698 9.40539 41.6908 9.40539C43.1264 9.40539 43.9019 10.5274 43.9019 12.1774C43.9019 13.8275 43.1264 14.9495 41.6908 14.9495C40.4698 14.9495 39.5458 14.042 39.5458 12.4415V11.9299Z" fill="black"/>
|
||||
<path id="Vector_3" d="M51.2545 16.682C52.987 16.682 54.3565 15.7745 54.967 14.2565L53.2675 13.613C53.0035 14.504 52.228 14.999 51.2545 14.999C49.9839 14.999 49.0929 14.0915 48.9444 12.6065H55.0165V11.9464C55.0165 9.57039 53.68 7.67285 51.172 7.67285C48.6639 7.67285 47.0469 9.63639 47.0469 12.1774C47.0469 14.8505 48.7794 16.682 51.2545 16.682ZM51.1555 9.33939C52.4095 9.33939 53.0035 10.1644 53.02 11.1214H49.0434C49.3404 9.9499 50.1324 9.33939 51.1555 9.33939Z" fill="black"/>
|
||||
<path id="Vector_4" d="M56.5038 16.5005H58.4838V11.4184C58.4838 10.1809 59.3913 9.52089 60.2824 9.52089C61.3714 9.52089 61.8004 10.2964 61.8004 11.3689V16.5005H63.7804V10.7914C63.7804 8.92688 62.6914 7.67285 60.8764 7.67285C59.7544 7.67285 58.9788 8.18436 58.4838 8.76188V7.83786H56.5038V16.5005Z" fill="black"/>
|
||||
<path id="Vector_5" d="M69.5799 4.65332L65.0918 16.5006H67.1873L68.1939 13.7945H73.309L74.332 16.5006H76.4605L71.9724 4.65332H69.5799ZM70.7349 6.99637L72.616 11.9465H68.8869L70.7349 6.99637Z" fill="black"/>
|
||||
<path id="Vector_6" d="M79.8581 4.6875H77.7461V16.5348H79.8581V4.6875Z" fill="black"/>
|
||||
<path id="Vector_7" d="M20.2769 9.00448C20.776 7.50639 20.6041 5.86529 19.8059 4.50264C18.6055 2.41259 16.1924 1.33732 13.8356 1.84333C12.7871 0.662179 11.2808 -0.00952316 9.70154 0.000102043C7.29248 -0.00539807 5.155 1.54563 4.41386 3.83781C2.86626 4.15475 1.53042 5.12346 0.748717 6.49643C-0.460621 8.58097 -0.184928 11.2087 1.43073 12.9962C0.931596 14.4943 1.10348 16.1354 1.90168 17.498C3.10208 19.5881 5.51526 20.6634 7.87206 20.1573C8.91983 21.3385 10.4269 22.0102 12.0061 21.9999C14.4165 22.0061 16.5547 20.4537 17.2958 18.1594C18.8434 17.8425 20.1793 16.8738 20.961 15.5008C22.1689 13.4163 21.8925 10.7906 20.2776 9.00311L20.2769 9.00448ZM12.0075 20.5623C11.0429 20.5637 10.1085 20.2261 9.36809 19.608C9.40178 19.5901 9.46022 19.5578 9.49803 19.5345L13.8789 17.0044C14.103 16.8772 14.2405 16.6386 14.2391 16.3808V10.2049L16.0906 11.274C16.1105 11.2836 16.1236 11.3028 16.1264 11.3248V16.4393C16.1236 18.7136 14.2818 20.5575 12.0075 20.5623ZM3.14952 16.7789C2.6662 15.9443 2.49225 14.9659 2.65795 14.0165C2.69026 14.0357 2.74732 14.0708 2.78789 14.0942L7.16873 16.6242C7.3908 16.7541 7.6658 16.7541 7.88856 16.6242L13.2367 13.5359V15.6741C13.2381 15.6961 13.2278 15.7174 13.2106 15.7311L8.78233 18.288C6.80985 19.4238 4.29079 18.7486 3.15021 16.7789H3.14952ZM1.99656 7.21626C2.47782 6.38024 3.23752 5.74085 4.14229 5.40878C4.14229 5.44659 4.14023 5.51328 4.14023 5.56003V10.6208C4.13885 10.878 4.27636 11.1165 4.4998 11.2437L9.84798 14.3313L7.9965 15.4004C7.97794 15.4128 7.95456 15.4149 7.93393 15.4059L3.50496 12.847C1.53661 11.7071 0.86147 9.18874 1.99587 7.21694L1.99656 7.21626ZM17.2085 10.7563L11.8603 7.66795L13.7118 6.59956C13.7304 6.58718 13.7537 6.58512 13.7744 6.59406L18.2033 9.15092C20.1751 10.2901 20.851 12.8126 19.7118 14.7844C19.2298 15.6191 18.4708 16.2584 17.5667 16.5912V11.3792C17.5688 11.122 17.432 10.8841 17.2092 10.7563H17.2085ZM19.0511 7.98284C19.0187 7.9629 18.9617 7.92852 18.9211 7.90515L14.5403 5.37509C14.3182 5.24515 14.0432 5.24515 13.8204 5.37509L8.47226 8.46341V6.32524C8.47088 6.30324 8.4812 6.28192 8.49838 6.26817L12.9267 3.71337C14.8991 2.57553 17.4209 3.25273 18.5581 5.2259C19.0387 6.05917 19.2126 7.03475 19.0497 7.98284H19.0511ZM7.46574 11.7937L5.61357 10.7246C5.59363 10.715 5.58057 10.6958 5.57782 10.6738V5.55935C5.5792 3.2823 7.42655 1.43701 9.7036 1.43838C10.6668 1.43838 11.5991 1.77664 12.3395 2.39265C12.3058 2.41053 12.2481 2.44284 12.2096 2.46622L7.82874 4.99627C7.60461 5.12346 7.46711 5.36134 7.46849 5.61916L7.46574 11.7924V11.7937ZM8.47157 9.62531L10.8538 8.24959L13.236 9.62462V12.3754L10.8538 13.7504L8.47157 12.3754V9.62531Z" fill="black"/>
|
||||
</g>
|
||||
</svg>
|
||||
<svg fill="currentColor" fill-rule="evenodd" height="56" viewBox="0 0 24 24" width="56" xmlns="http://www.w3.org/2000/svg" style="flex: 0 0 auto; line-height: 1;"><title>LM Studio</title><path d="M2.84 2a1.273 1.273 0 100 2.547h14.107a1.273 1.273 0 100-2.547H2.84zM7.935 5.33a1.273 1.273 0 000 2.548H22.04a1.274 1.274 0 000-2.547H7.935zM3.624 9.935c0-.704.57-1.274 1.274-1.274h14.106a1.274 1.274 0 010 2.547H4.898c-.703 0-1.274-.57-1.274-1.273zM1.273 12.188a1.273 1.273 0 100 2.547H15.38a1.274 1.274 0 000-2.547H1.273zM3.624 16.792c0-.704.57-1.274 1.274-1.274h14.106a1.273 1.273 0 110 2.547H4.898c-.703 0-1.274-.57-1.274-1.273zM13.029 18.849a1.273 1.273 0 100 2.547h9.698a1.273 1.273 0 100-2.547h-9.698z" fill-opacity=".3"></path><path d="M2.84 2a1.273 1.273 0 100 2.547h10.287a1.274 1.274 0 000-2.547H2.84zM7.935 5.33a1.273 1.273 0 000 2.548H18.22a1.274 1.274 0 000-2.547H7.935zM3.624 9.935c0-.704.57-1.274 1.274-1.274h10.286a1.273 1.273 0 010 2.547H4.898c-.703 0-1.274-.57-1.274-1.273zM1.273 12.188a1.273 1.273 0 100 2.547H11.56a1.274 1.274 0 000-2.547H1.273zM3.624 16.792c0-.704.57-1.274 1.274-1.274h10.286a1.273 1.273 0 110 2.547H4.898c-.703 0-1.274-.57-1.274-1.273zM13.029 18.849a1.273 1.273 0 100 2.547h5.78a1.273 1.273 0 100-2.547h-5.78z"></path></svg>
|
||||
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -96,4 +96,14 @@ model_credential_schema:
|
||||
label:
|
||||
en_US: 'No'
|
||||
zh_Hans: 否
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://lmstudio.ai
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://lmstudio.ai
|
||||
|
||||
@@ -27,6 +27,14 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.minimax.chat
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.minimax.chat/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.minimax.chat/v1
|
||||
recommend: true
|
||||
sort: 5
|
||||
@@ -29,4 +29,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.mistral.ai
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.mistral.ai
|
||||
@@ -31,6 +31,14 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.moonshot.cn
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.moonshot.cn/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.moonshot.cn/v1
|
||||
recommend: true
|
||||
sort: 6
|
||||
@@ -29,4 +29,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.novita.ai
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.novita.ai/v3/openai
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.novita.ai/v3/openai
|
||||
@@ -31,4 +31,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://integrate.api.nvidia.com
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://integrate.api.nvidia.com
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 17 KiB |
@@ -17,6 +17,17 @@ supported_model_types:
|
||||
- text-embedding
|
||||
configurate_methods:
|
||||
- customizable-model
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: base_url
|
||||
label:
|
||||
zh_Hans: API Base
|
||||
en_US: API Base
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Base, 如:http://127.0.0.1:11434
|
||||
en_US: Enter your API Base, e.g. http://127.0.0.1:11434
|
||||
model_credential_schema:
|
||||
model:
|
||||
label:
|
||||
|
||||
@@ -78,6 +78,6 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Base, 如:https://api.openai.com
|
||||
en_US: Enter your API Base, e.g. https://api.openai.com
|
||||
address: https://api.openai.com
|
||||
address: https://api.openai.com/v1
|
||||
recommend: true
|
||||
sort: 1
|
||||
@@ -103,4 +103,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://openrouter.ai
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://openrouter.ai/api/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://openrouter.ai/api/v1
|
||||
@@ -31,4 +31,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://cloud.perfxlab.cn
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://perfxcloud.io/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://perfxcloud.io/v1
|
||||
@@ -30,4 +30,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.openai.com
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://perfxcloud.io/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.siliconflow.cn/v1
|
||||
@@ -20,13 +20,20 @@ configurate_methods:
|
||||
- predefined-model
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: api_password
|
||||
- variable: api_key
|
||||
label:
|
||||
en_US: APIPassword
|
||||
en_US: API Key
|
||||
type: secret-input
|
||||
required: true
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 APIPassword
|
||||
en_US: Enter your APIPassword
|
||||
|
||||
address: https://spark-api-open.xf-yun.com
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://spark-api-open.xf-yun.com/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://spark-api-open.xf-yun.com/v1
|
||||
@@ -31,6 +31,14 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.stepfun.com/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
model_credential_schema:
|
||||
model:
|
||||
label:
|
||||
@@ -79,4 +87,4 @@ model_credential_schema:
|
||||
label:
|
||||
en_US: Tool Call
|
||||
zh_Hans: Tool Call
|
||||
address: https://api.stepfun.com
|
||||
address: https://api.stepfun.com/v1
|
||||
@@ -29,4 +29,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://dashscope.aliyuncs.com
|
||||
- variable: dashscope_api_base
|
||||
label:
|
||||
en_US: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||
@@ -47,4 +47,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.upstage.ai
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.upstage.ai/v1/solar
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.upstage.ai/v1/solar
|
||||
@@ -1,4 +1,4 @@
|
||||
model: claude-3-haiku@20240307
|
||||
model: google/claude-3-haiku@20240307
|
||||
label:
|
||||
en_US: Claude 3 Haiku
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: claude-3-opus@20240229
|
||||
model: google/claude-3-opus@20240229
|
||||
label:
|
||||
en_US: Claude 3 Opus
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: claude-3-sonnet@20240229
|
||||
model: google/claude-3-sonnet@20240229
|
||||
label:
|
||||
en_US: Claude 3 Sonnet
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: claude-3-5-sonnet-v2@20241022
|
||||
model: google/claude-3-5-sonnet-v2@20241022
|
||||
label:
|
||||
en_US: Claude 3.5 Sonnet v2
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: claude-3-5-sonnet@20240620
|
||||
model: google/claude-3-5-sonnet@20240620
|
||||
label:
|
||||
en_US: Claude 3.5 Sonnet
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-1.0-pro-vision-001
|
||||
model: google/gemini-1.0-pro-vision-001
|
||||
label:
|
||||
en_US: Gemini 1.0 Pro Vision
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-1.0-pro-002
|
||||
model: google/gemini-1.0-pro-002
|
||||
label:
|
||||
en_US: Gemini 1.0 Pro
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-1.5-flash-001
|
||||
model: google/gemini-1.5-flash-001
|
||||
label:
|
||||
en_US: Gemini 1.5 Flash 001
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-1.5-flash-002
|
||||
model: google/gemini-1.5-flash-002
|
||||
label:
|
||||
en_US: Gemini 1.5 Flash 002
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-1.5-pro-001
|
||||
model: google/gemini-1.5-pro-001
|
||||
label:
|
||||
en_US: Gemini 1.5 Pro 001
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-1.5-pro-002
|
||||
model: google/gemini-1.5-pro-002
|
||||
label:
|
||||
en_US: Gemini 1.5 Pro 002
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-2.0-flash-001
|
||||
model: google/gemini-2.0-flash-001
|
||||
label:
|
||||
en_US: Gemini 2.0 Flash 001
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-2.0-flash-exp
|
||||
model: google/gemini-2.0-flash-exp
|
||||
label:
|
||||
en_US: Gemini 2.0 Flash Exp
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-2.0-flash-lite-preview-02-05
|
||||
model: google/gemini-2.0-flash-lite-preview-02-05
|
||||
label:
|
||||
en_US: Gemini 2.0 Flash Lite Preview 0205
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-2.0-flash-thinking-exp-01-21
|
||||
model: google/gemini-2.0-flash-thinking-exp-01-21
|
||||
label:
|
||||
en_US: Gemini 2.0 Flash Thinking Exp 0121
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-2.0-pro-exp-02-05
|
||||
model: google/gemini-2.0-pro-exp-02-05
|
||||
label:
|
||||
en_US: Gemini 2.0 Pro Exp 0205
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-exp-1114
|
||||
model: google/gemini-exp-1114
|
||||
label:
|
||||
en_US: Gemini exp 1114
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-exp-1121
|
||||
model: google/gemini-exp-1121
|
||||
label:
|
||||
en_US: Gemini exp 1121
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-exp-1206
|
||||
model: google/gemini-exp-1206
|
||||
label:
|
||||
en_US: Gemini exp 1206
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-flash-experimental
|
||||
model: google/gemini-flash-experimental
|
||||
label:
|
||||
en_US: Gemini Flash Experimental
|
||||
model_type: llm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
model: gemini-pro-experimental
|
||||
model: google/gemini-pro-experimental
|
||||
label:
|
||||
en_US: Gemini Pro Experimental
|
||||
model_type: llm
|
||||
|
||||
@@ -20,6 +20,15 @@ configurate_methods:
|
||||
- predefined-model
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: vertex_api_base
|
||||
label:
|
||||
zh_Hans: API Base
|
||||
en_US: API Base
|
||||
type: text-input
|
||||
required: true
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Base
|
||||
en_US: Enter your API Base
|
||||
- variable: vertex_project_id
|
||||
label:
|
||||
en_US: Project ID
|
||||
@@ -36,9 +45,12 @@ provider_credential_schema:
|
||||
en_US: Enter your Google Cloud Location
|
||||
- variable: vertex_service_account_key
|
||||
label:
|
||||
en_US: Service Account Key (Leave blank if you use Application Default Credentials)
|
||||
en_US: Enter your Google Cloud Service Account Key in base64 format
|
||||
type: secret-input
|
||||
required: false
|
||||
required: true
|
||||
placeholder:
|
||||
en_US: Enter your Google Cloud Service Account Key in base64 format
|
||||
address: https://api.openai.com
|
||||
address: https://api.openai.com
|
||||
model_config:
|
||||
access_configuration_status: true
|
||||
access_configuration_demo: "{\"vertex_location\": \"\", \"vertex_project_id\": \"\", \"vertex_model\":\"\"}"
|
||||
@@ -1,342 +1,357 @@
|
||||
provider: volcengine_maas
|
||||
label:
|
||||
en_US: Volcengine
|
||||
description:
|
||||
en_US: Volcengine Ark models.
|
||||
zh_Hans: 火山方舟提供的模型,例如 Doubao-pro-4k、Doubao-pro-32k 和 Doubao-pro-128k。
|
||||
icon_small:
|
||||
en_US: icon_s_en.svg
|
||||
icon_large:
|
||||
en_US: icon_l_en.svg
|
||||
zh_Hans: icon_l_zh.svg
|
||||
background: "#F9FAFB"
|
||||
help:
|
||||
title:
|
||||
en_US: Get your Access Key and Secret Access Key from Volcengine Console
|
||||
zh_Hans: 从火山引擎控制台获取您的 Access Key 和 Secret Access Key
|
||||
url:
|
||||
en_US: https://console.volcengine.com/iam/keymanage/
|
||||
supported_model_types:
|
||||
- llm
|
||||
- text-embedding
|
||||
configurate_methods:
|
||||
- customizable-model
|
||||
model_credential_schema:
|
||||
model:
|
||||
label:
|
||||
en_US: Model Name
|
||||
zh_Hans: 模型名称
|
||||
placeholder:
|
||||
en_US: Enter your Model Name
|
||||
zh_Hans: 输入模型名称
|
||||
credential_form_schemas:
|
||||
- variable: auth_method
|
||||
required: true
|
||||
label:
|
||||
en_US: Authentication Method
|
||||
zh_Hans: 鉴权方式
|
||||
type: select
|
||||
default: aksk
|
||||
options:
|
||||
- label:
|
||||
en_US: API Key
|
||||
value: api_key
|
||||
- label:
|
||||
en_US: Access Key / Secret Access Key
|
||||
value: aksk
|
||||
placeholder:
|
||||
en_US: Enter your Authentication Method
|
||||
zh_Hans: 选择鉴权方式
|
||||
- variable: volc_access_key_id
|
||||
required: true
|
||||
show_on:
|
||||
- variable: auth_method
|
||||
value: aksk
|
||||
label:
|
||||
en_US: Access Key
|
||||
zh_Hans: Access Key
|
||||
type: secret-input
|
||||
placeholder:
|
||||
en_US: Enter your Access Key
|
||||
zh_Hans: 输入您的 Access Key
|
||||
- variable: volc_secret_access_key
|
||||
required: true
|
||||
show_on:
|
||||
- variable: auth_method
|
||||
value: aksk
|
||||
label:
|
||||
en_US: Secret Access Key
|
||||
zh_Hans: Secret Access Key
|
||||
type: secret-input
|
||||
placeholder:
|
||||
en_US: Enter your Secret Access Key
|
||||
zh_Hans: 输入您的 Secret Access Key
|
||||
- variable: volc_api_key
|
||||
required: true
|
||||
show_on:
|
||||
- variable: auth_method
|
||||
value: api_key
|
||||
label:
|
||||
en_US: API Key
|
||||
type: secret-input
|
||||
placeholder:
|
||||
en_US: Enter your API Key
|
||||
zh_Hans: 输入您的 API Key
|
||||
- variable: volc_region
|
||||
required: true
|
||||
label:
|
||||
en_US: Volcengine Region
|
||||
zh_Hans: 火山引擎地域
|
||||
type: text-input
|
||||
default: cn-beijing
|
||||
placeholder:
|
||||
en_US: Enter Volcengine Region
|
||||
zh_Hans: 输入火山引擎地域
|
||||
- variable: api_endpoint_host
|
||||
required: true
|
||||
label:
|
||||
en_US: API Endpoint Host
|
||||
zh_Hans: API Endpoint Host
|
||||
type: text-input
|
||||
default: https://ark.cn-beijing.volces.com/api/v3
|
||||
placeholder:
|
||||
en_US: Enter your API Endpoint Host
|
||||
zh_Hans: 输入 API Endpoint Host
|
||||
- variable: endpoint_id
|
||||
required: true
|
||||
label:
|
||||
en_US: Endpoint ID
|
||||
zh_Hans: Endpoint ID
|
||||
type: text-input
|
||||
placeholder:
|
||||
en_US: Enter your Endpoint ID
|
||||
zh_Hans: 输入您的 Endpoint ID
|
||||
- variable: base_model_name
|
||||
label:
|
||||
en_US: Base Model
|
||||
zh_Hans: 基础模型
|
||||
type: select
|
||||
required: true
|
||||
options:
|
||||
- label:
|
||||
en_US: DeepSeek-R1-Distill-Qwen-32B
|
||||
value: DeepSeek-R1-Distill-Qwen-32B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: DeepSeek-R1-Distill-Qwen-7B
|
||||
value: DeepSeek-R1-Distill-Qwen-7B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: DeepSeek-R1
|
||||
value: DeepSeek-R1
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: DeepSeek-V3
|
||||
value: DeepSeek-V3
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-1.5-vision-pro-32k
|
||||
value: Doubao-1.5-vision-pro-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-1.5-pro-32k
|
||||
value: Doubao-1.5-pro-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-1.5-lite-32k
|
||||
value: Doubao-1.5-lite-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-1.5-pro-256k
|
||||
value: Doubao-1.5-pro-256k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-vision-pro-32k
|
||||
value: Doubao-vision-pro-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-vision-lite-32k
|
||||
value: Doubao-vision-lite-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-pro-4k
|
||||
value: Doubao-pro-4k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-lite-4k
|
||||
value: Doubao-lite-4k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-pro-32k
|
||||
value: Doubao-pro-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-lite-32k
|
||||
value: Doubao-lite-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-pro-128k
|
||||
value: Doubao-pro-128k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-lite-128k
|
||||
value: Doubao-lite-128k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-pro-256k
|
||||
value: Doubao-pro-256k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Llama3-8B
|
||||
value: Llama3-8B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Llama3-70B
|
||||
value: Llama3-70B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Moonshot-v1-8k
|
||||
value: Moonshot-v1-8k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Moonshot-v1-32k
|
||||
value: Moonshot-v1-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Moonshot-v1-128k
|
||||
value: Moonshot-v1-128k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: GLM3-130B
|
||||
value: GLM3-130B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: GLM3-130B-Fin
|
||||
value: GLM3-130B-Fin
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Mistral-7B
|
||||
value: Mistral-7B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-embedding
|
||||
value: Doubao-embedding
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: text-embedding
|
||||
- label:
|
||||
en_US: Doubao-embedding-large
|
||||
value: Doubao-embedding-large
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: text-embedding
|
||||
- label:
|
||||
en_US: Custom
|
||||
zh_Hans: 自定义
|
||||
value: Custom
|
||||
- variable: mode
|
||||
required: true
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- variable: base_model_name
|
||||
value: Custom
|
||||
label:
|
||||
zh_Hans: 模型类型
|
||||
en_US: Completion Mode
|
||||
type: select
|
||||
default: chat
|
||||
placeholder:
|
||||
zh_Hans: 选择对话类型
|
||||
en_US: Select Completion Mode
|
||||
options:
|
||||
- value: completion
|
||||
label:
|
||||
en_US: Completion
|
||||
zh_Hans: 补全
|
||||
- value: chat
|
||||
label:
|
||||
en_US: Chat
|
||||
zh_Hans: 对话
|
||||
- variable: context_size
|
||||
required: true
|
||||
show_on:
|
||||
- variable: base_model_name
|
||||
value: Custom
|
||||
label:
|
||||
zh_Hans: 模型上下文长度
|
||||
en_US: Model Context Size
|
||||
type: text-input
|
||||
default: "4096"
|
||||
placeholder:
|
||||
zh_Hans: 输入您的模型上下文长度
|
||||
en_US: Enter your Model Context Size
|
||||
- variable: max_tokens
|
||||
required: true
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- variable: base_model_name
|
||||
value: Custom
|
||||
label:
|
||||
zh_Hans: 最大 token 上限
|
||||
en_US: Upper Bound for Max Tokens
|
||||
default: "4096"
|
||||
type: text-input
|
||||
placeholder:
|
||||
zh_Hans: 输入您的模型最大 token 上限
|
||||
en_US: Enter your model Upper Bound for Max Tokens
|
||||
address: https://open.volcengine.com
|
||||
model_config:
|
||||
access_configuration_status: true
|
||||
access_configuration_demo: "{\"endpoint\": \"https://196.1.1.2:3824\"}"
|
||||
provider: volcengine_maas
|
||||
label:
|
||||
en_US: Volcengine
|
||||
description:
|
||||
en_US: Volcengine Ark models.
|
||||
zh_Hans: 火山方舟提供的模型,例如 Doubao-pro-4k、Doubao-pro-32k 和 Doubao-pro-128k。
|
||||
icon_small:
|
||||
en_US: icon_s_en.svg
|
||||
icon_large:
|
||||
en_US: icon_l_en.svg
|
||||
zh_Hans: icon_l_zh.svg
|
||||
background: "#F9FAFB"
|
||||
help:
|
||||
title:
|
||||
en_US: Get your Access Key and Secret Access Key from Volcengine Console
|
||||
zh_Hans: 从火山引擎控制台获取您的 Access Key 和 Secret Access Key
|
||||
url:
|
||||
en_US: https://console.volcengine.com/iam/keymanage/
|
||||
supported_model_types:
|
||||
- llm
|
||||
- text-embedding
|
||||
configurate_methods:
|
||||
- customizable-model
|
||||
|
||||
model_credential_schema:
|
||||
model:
|
||||
label:
|
||||
en_US: Model Name
|
||||
zh_Hans: 模型名称
|
||||
placeholder:
|
||||
en_US: Enter your Model Name
|
||||
zh_Hans: 输入模型名称
|
||||
credential_form_schemas:
|
||||
- variable: auth_method
|
||||
required: true
|
||||
label:
|
||||
en_US: Authentication Method
|
||||
zh_Hans: 鉴权方式
|
||||
type: select
|
||||
default: aksk
|
||||
options:
|
||||
- label:
|
||||
en_US: API Key
|
||||
value: api_key
|
||||
- label:
|
||||
en_US: Access Key / Secret Access Key
|
||||
value: aksk
|
||||
placeholder:
|
||||
en_US: Enter your Authentication Method
|
||||
zh_Hans: 选择鉴权方式
|
||||
- variable: volc_access_key_id
|
||||
required: true
|
||||
show_on:
|
||||
- variable: auth_method
|
||||
value: aksk
|
||||
label:
|
||||
en_US: Access Key
|
||||
zh_Hans: Access Key
|
||||
type: secret-input
|
||||
placeholder:
|
||||
en_US: Enter your Access Key
|
||||
zh_Hans: 输入您的 Access Key
|
||||
- variable: volc_secret_access_key
|
||||
required: true
|
||||
show_on:
|
||||
- variable: auth_method
|
||||
value: aksk
|
||||
label:
|
||||
en_US: Secret Access Key
|
||||
zh_Hans: Secret Access Key
|
||||
type: secret-input
|
||||
placeholder:
|
||||
en_US: Enter your Secret Access Key
|
||||
zh_Hans: 输入您的 Secret Access Key
|
||||
- variable: volc_api_key
|
||||
required: true
|
||||
show_on:
|
||||
- variable: auth_method
|
||||
value: api_key
|
||||
label:
|
||||
en_US: API Key
|
||||
type: secret-input
|
||||
placeholder:
|
||||
en_US: Enter your API Key
|
||||
zh_Hans: 输入您的 API Key
|
||||
- variable: volc_region
|
||||
required: true
|
||||
label:
|
||||
en_US: Volcengine Region
|
||||
zh_Hans: 火山引擎地域
|
||||
type: text-input
|
||||
default: cn-beijing
|
||||
placeholder:
|
||||
en_US: Enter Volcengine Region
|
||||
zh_Hans: 输入火山引擎地域
|
||||
- variable: api_endpoint_host
|
||||
required: true
|
||||
label:
|
||||
en_US: API Endpoint Host
|
||||
zh_Hans: API Endpoint Host
|
||||
type: text-input
|
||||
default: https://ark.cn-beijing.volces.com/api/v3
|
||||
placeholder:
|
||||
en_US: Enter your API Endpoint Host
|
||||
zh_Hans: 输入 API Endpoint Host
|
||||
- variable: endpoint_id
|
||||
required: true
|
||||
label:
|
||||
en_US: Endpoint ID
|
||||
zh_Hans: Endpoint ID
|
||||
type: text-input
|
||||
placeholder:
|
||||
en_US: Enter your Endpoint ID
|
||||
zh_Hans: 输入您的 Endpoint ID
|
||||
- variable: base_model_name
|
||||
label:
|
||||
en_US: Base Model
|
||||
zh_Hans: 基础模型
|
||||
type: select
|
||||
required: true
|
||||
options:
|
||||
- label:
|
||||
en_US: DeepSeek-R1-Distill-Qwen-32B
|
||||
value: DeepSeek-R1-Distill-Qwen-32B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: DeepSeek-R1-Distill-Qwen-7B
|
||||
value: DeepSeek-R1-Distill-Qwen-7B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: DeepSeek-R1
|
||||
value: DeepSeek-R1
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: DeepSeek-V3
|
||||
value: DeepSeek-V3
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-1.5-vision-pro-32k
|
||||
value: Doubao-1.5-vision-pro-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-1.5-pro-32k
|
||||
value: Doubao-1.5-pro-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-1.5-lite-32k
|
||||
value: Doubao-1.5-lite-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-1.5-pro-256k
|
||||
value: Doubao-1.5-pro-256k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-vision-pro-32k
|
||||
value: Doubao-vision-pro-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-vision-lite-32k
|
||||
value: Doubao-vision-lite-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-pro-4k
|
||||
value: Doubao-pro-4k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-lite-4k
|
||||
value: Doubao-lite-4k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-pro-32k
|
||||
value: Doubao-pro-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-lite-32k
|
||||
value: Doubao-lite-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-pro-128k
|
||||
value: Doubao-pro-128k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-lite-128k
|
||||
value: Doubao-lite-128k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-pro-256k
|
||||
value: Doubao-pro-256k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Llama3-8B
|
||||
value: Llama3-8B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Llama3-70B
|
||||
value: Llama3-70B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Moonshot-v1-8k
|
||||
value: Moonshot-v1-8k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Moonshot-v1-32k
|
||||
value: Moonshot-v1-32k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Moonshot-v1-128k
|
||||
value: Moonshot-v1-128k
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: GLM3-130B
|
||||
value: GLM3-130B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: GLM3-130B-Fin
|
||||
value: GLM3-130B-Fin
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Mistral-7B
|
||||
value: Mistral-7B
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- label:
|
||||
en_US: Doubao-embedding
|
||||
value: Doubao-embedding
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: text-embedding
|
||||
- label:
|
||||
en_US: Doubao-embedding-large
|
||||
value: Doubao-embedding-large
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: text-embedding
|
||||
- label:
|
||||
en_US: Custom
|
||||
zh_Hans: 自定义
|
||||
value: Custom
|
||||
- variable: mode
|
||||
required: true
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- variable: base_model_name
|
||||
value: Custom
|
||||
label:
|
||||
zh_Hans: 模型类型
|
||||
en_US: Completion Mode
|
||||
type: select
|
||||
default: chat
|
||||
placeholder:
|
||||
zh_Hans: 选择对话类型
|
||||
en_US: Select Completion Mode
|
||||
options:
|
||||
- value: completion
|
||||
label:
|
||||
en_US: Completion
|
||||
zh_Hans: 补全
|
||||
- value: chat
|
||||
label:
|
||||
en_US: Chat
|
||||
zh_Hans: 对话
|
||||
- variable: context_size
|
||||
required: true
|
||||
show_on:
|
||||
- variable: base_model_name
|
||||
value: Custom
|
||||
label:
|
||||
zh_Hans: 模型上下文长度
|
||||
en_US: Model Context Size
|
||||
type: text-input
|
||||
default: "4096"
|
||||
placeholder:
|
||||
zh_Hans: 输入您的模型上下文长度
|
||||
en_US: Enter your Model Context Size
|
||||
- variable: max_tokens
|
||||
required: true
|
||||
show_on:
|
||||
- variable: __model_type
|
||||
value: llm
|
||||
- variable: base_model_name
|
||||
value: Custom
|
||||
label:
|
||||
zh_Hans: 最大 token 上限
|
||||
en_US: Upper Bound for Max Tokens
|
||||
default: "4096"
|
||||
type: text-input
|
||||
placeholder:
|
||||
zh_Hans: 输入您的模型最大 token 上限
|
||||
en_US: Enter your model Upper Bound for Max Tokens
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: api_key
|
||||
label:
|
||||
en_US: APIKey
|
||||
type: secret-input
|
||||
required: true
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 APIKey
|
||||
en_US: Enter your APIKey
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://ark.cn-beijing.volces.com/api/v3
|
||||
required: true
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base url
|
||||
en_US: Enter your Base url
|
||||
address: https://ark.cn-beijing.volces.com/api/v3
|
||||
|
||||
@@ -30,14 +30,14 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
- variable: secret_key
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: Secret Key
|
||||
type: secret-input
|
||||
required: true
|
||||
en_US: https://qianfan.baidubce.com/v2
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Secret Key
|
||||
en_US: Enter your Secret Key
|
||||
address: https://aip.baidubce.com
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://qianfan.baidubce.com/v2
|
||||
recommend: true
|
||||
sort: 7
|
||||
@@ -76,4 +76,14 @@ model_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入调用重试次数
|
||||
en_US: Enter max retries
|
||||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: Base URL
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://xinference.ai
|
||||
@@ -30,4 +30,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
address: https://api.lingyiwanwu.com
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://api.lingyiwanwu.com/v1
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.lingyiwanwu.com/v1
|
||||
@@ -30,4 +30,12 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 API Key
|
||||
en_US: Enter your API Key
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: Base URL
|
||||
type: text-input
|
||||
required: false
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base URL
|
||||
en_US: Enter your Base URL
|
||||
address: https://api.360.cn
|
||||
@@ -29,4 +29,11 @@ provider_credential_schema:
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 APIKey
|
||||
en_US: Enter your APIKey
|
||||
address: https://open.bigmodel.cn
|
||||
- variable: base_url
|
||||
label:
|
||||
en_US: https://open.bigmodel.cn/api/paas/v4/
|
||||
required: true
|
||||
placeholder:
|
||||
zh_Hans: 在此输入您的 Base url
|
||||
en_US: Enter your Base url
|
||||
address: https://open.bigmodel.cn/api/paas/v4/
|
||||
@@ -97,6 +97,10 @@ func NewModel(data string, logo string) (IModel, error) {
|
||||
params := make(ParamValidator, 0, len(cfg.ParameterRules))
|
||||
defaultConfig := make(map[string]interface{})
|
||||
for _, p := range cfg.ParameterRules {
|
||||
if (p.Default == nil || p.Default == "" || p.Default == 0 || p.Default == false) && !p.Required {
|
||||
defaultConfig[p.Name] = nil
|
||||
continue
|
||||
}
|
||||
t := p.Type
|
||||
if t == "" {
|
||||
t = ParameterTypeStr
|
||||
|
||||
@@ -50,7 +50,7 @@ type IProviderInfo interface {
|
||||
}
|
||||
|
||||
func GetCustomizeLogo() string {
|
||||
logo, _ := providerDir.ReadFile("customize/assets/icon_s_en.svg")
|
||||
logo, _ := providerDir.ReadFile("model-providers/customize/assets/icon_s_en.svg")
|
||||
|
||||
return string(logo)
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ func convertInt(value interface{}) int {
|
||||
|
||||
func genAIKey(key string, provider string) string {
|
||||
keys := strings.Split(key, "@")
|
||||
return strings.TrimSuffix(keys[0], fmt.Sprintf("-%s", provider))
|
||||
return strings.TrimPrefix(keys[0], fmt.Sprintf("%s-", provider))
|
||||
}
|
||||
|
||||
// HandleMessage 处理从 NSQ 读取的消息
|
||||
|
||||
@@ -25,6 +25,8 @@ const (
|
||||
CIDRIpv4Exp = `^(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([1-9]|[1-2]\d|3[0-2]))?$`
|
||||
// CheckPathIPPortExp (scheme://)?ip:port
|
||||
CheckPathIPPortExp = `([a-zA-z]+://)?((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}:[0-9]+`
|
||||
// EnglishOrNumberOrSpecialChars a-zA-Z0-9-_.:
|
||||
EnglishOrNumberOrSpecialChars = `^(?i)[-/:._a-z0-9]+$`
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -47,6 +49,8 @@ var (
|
||||
restfulPathMatchRegexp = regexp.MustCompile(`({[0-9a-zA-Z-_]+})+`)
|
||||
//restfulParamMatchRegexp 匹配restful参数 {xxx}
|
||||
restfulParamMatchRegexp = regexp.MustCompile(`^{[0-9a-zA-Z-_]+}$`)
|
||||
// modelNameRegexp match model name
|
||||
modelNameRegexp = regexp.MustCompile(EnglishOrNumberOrSpecialChars)
|
||||
)
|
||||
|
||||
func IsMatchString(regexpPattern RegexpPattern, s string) error {
|
||||
@@ -129,3 +133,8 @@ func ReplaceRestfulPath(path, replaceStr string) string {
|
||||
func CheckPathContainsIPPort(path string) bool {
|
||||
return checkIPPortRegexp.MatchString(path)
|
||||
}
|
||||
|
||||
// ModelNameValid check model name is valid
|
||||
func ModelNameValid(param string) bool {
|
||||
return modelNameRegexp.MatchString(param)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
ai_provider_local "github.com/APIParkLab/APIPark/ai-provider/local"
|
||||
|
||||
"github.com/APIParkLab/APIPark/model/plugin_model"
|
||||
ai_api "github.com/APIParkLab/APIPark/module/ai-api"
|
||||
ai_api_dto "github.com/APIParkLab/APIPark/module/ai-api/dto"
|
||||
@@ -48,13 +50,13 @@ func (i *imlAPIController) Create(ctx *gin.Context, serviceId string, input *ai_
|
||||
}
|
||||
}
|
||||
if input.AiModel != nil {
|
||||
provider := "ollama"
|
||||
provider := ai_provider_local.ProviderLocal
|
||||
if input.AiModel.Type != "local" {
|
||||
provider = input.AiModel.Provider
|
||||
}
|
||||
plugins["ai_formatter"] = api.PluginSetting{
|
||||
Config: plugin_model.ConfigType{
|
||||
"model": input.AiModel.Id,
|
||||
"model": input.AiModel.Name,
|
||||
"provider": provider,
|
||||
"config": input.AiModel.Config,
|
||||
},
|
||||
@@ -63,6 +65,7 @@ func (i *imlAPIController) Create(ctx *gin.Context, serviceId string, input *ai_
|
||||
|
||||
_, err = i.routerModule.Create(ctx, serviceId, &router_dto.Create{
|
||||
Id: input.Id,
|
||||
Name: input.Name,
|
||||
Path: input.Path,
|
||||
Methods: []string{
|
||||
http.MethodPost,
|
||||
@@ -106,13 +109,13 @@ func (i *imlAPIController) Edit(ctx *gin.Context, serviceId string, apiId string
|
||||
}
|
||||
//var upstream *string
|
||||
if input.AiModel != nil {
|
||||
provider := "ollama"
|
||||
provider := ai_provider_local.ProviderLocal
|
||||
if input.AiModel.Type != "local" {
|
||||
provider = input.AiModel.Provider
|
||||
}
|
||||
proxy.Plugins["ai_formatter"] = api.PluginSetting{
|
||||
Config: plugin_model.ConfigType{
|
||||
"model": input.AiModel.Id,
|
||||
"model": input.AiModel.Name,
|
||||
"provider": provider,
|
||||
"config": input.AiModel.Config,
|
||||
},
|
||||
@@ -130,6 +133,7 @@ func (i *imlAPIController) Edit(ctx *gin.Context, serviceId string, apiId string
|
||||
}
|
||||
|
||||
_, err = i.routerModule.Edit(ctx, serviceId, apiId, &router_dto.Edit{
|
||||
Name: input.Name,
|
||||
Description: input.Description,
|
||||
Proxy: proxy,
|
||||
Path: input.Path,
|
||||
|
||||
@@ -245,7 +245,7 @@ func (i *imlLocalModelController) initAILocalService(ctx context.Context, model
|
||||
}
|
||||
serviceId := uuid.NewString()
|
||||
prefix := fmt.Sprintf("/%s", serviceId[:8])
|
||||
providerId := "ollama"
|
||||
providerId := ai_provider_local.ProviderLocal
|
||||
err = i.transaction.Transaction(ctx, func(ctx context.Context) error {
|
||||
_, err = i.serviceModule.Create(ctx, teamID, &service_dto.CreateService{
|
||||
Id: serviceId,
|
||||
@@ -267,7 +267,7 @@ func (i *imlLocalModelController) initAILocalService(ctx context.Context, model
|
||||
})
|
||||
|
||||
return func() error {
|
||||
path := fmt.Sprintf("/%s/chat", strings.Trim(prefix, "/"))
|
||||
path := fmt.Sprintf("/%s/chat/completions", strings.Trim(prefix, "/"))
|
||||
timeout := 300000
|
||||
retry := 0
|
||||
aiPrompt := &ai_api_dto.AiPrompt{
|
||||
@@ -276,7 +276,7 @@ func (i *imlLocalModelController) initAILocalService(ctx context.Context, model
|
||||
}
|
||||
aiModel := &ai_api_dto.AiModel{
|
||||
Id: model,
|
||||
Config: ai_provider_local.OllamaConfig,
|
||||
Config: ai_provider_local.LocalConfig,
|
||||
Provider: providerId,
|
||||
Type: "local",
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package ai_model
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/APIParkLab/APIPark/common"
|
||||
ai_model "github.com/APIParkLab/APIPark/module/ai-model"
|
||||
model_dto "github.com/APIParkLab/APIPark/module/ai-model/dto"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -22,8 +23,8 @@ func (i *imlProviderModelController) GetModelParametersTemplate(ctx *gin.Context
|
||||
}
|
||||
|
||||
func (i *imlProviderModelController) UpdateProviderModel(ctx *gin.Context, provider string, input *model_dto.EditModel) error {
|
||||
if strings.TrimSpace(input.Name) == "" {
|
||||
return fmt.Errorf("name is empty")
|
||||
if !common.ModelNameValid(input.Name) {
|
||||
return fmt.Errorf("model name is invalid(a-zA-Z0-9-_.:/)")
|
||||
}
|
||||
if strings.TrimSpace(input.Id) == "" {
|
||||
return fmt.Errorf("id is empty")
|
||||
@@ -54,8 +55,8 @@ func (i *imlProviderModelController) DeleteProviderModel(ctx *gin.Context, provi
|
||||
}
|
||||
|
||||
func (i *imlProviderModelController) AddProviderModel(ctx *gin.Context, provider string, input *model_dto.Model) (*model_dto.SimpleModel, error) {
|
||||
if strings.TrimSpace(input.Name) == "" {
|
||||
return nil, fmt.Errorf("name is empty")
|
||||
if !common.ModelNameValid(input.Name) {
|
||||
return nil, fmt.Errorf("model name illegal(a-zA-Z0-9-_.:/)")
|
||||
}
|
||||
if strings.TrimSpace(provider) == "" {
|
||||
return nil, fmt.Errorf("provider is empty")
|
||||
|
||||
@@ -3,6 +3,7 @@ package ai
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/APIParkLab/APIPark/common"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -24,8 +25,8 @@ func (i *imlProviderController) Delete(ctx *gin.Context, id string) error {
|
||||
}
|
||||
|
||||
func (i *imlProviderController) AddProvider(ctx *gin.Context, input *ai_dto.NewProvider) (*ai_dto.SimpleProvider, error) {
|
||||
if strings.TrimSpace(input.Name) == "" {
|
||||
return nil, fmt.Errorf("name is empty")
|
||||
if !common.ModelNameValid(input.Name) {
|
||||
return nil, fmt.Errorf("name illegal(a-zA-Z0-9-_.:/)")
|
||||
}
|
||||
return i.module.AddProvider(ctx, input)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
package mcp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
mcp_server "github.com/APIParkLab/APIPark/mcp-server"
|
||||
"github.com/APIParkLab/APIPark/module/mcp"
|
||||
"github.com/APIParkLab/APIPark/module/system"
|
||||
"github.com/eolinker/go-common/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
mcp2 "github.com/mark3labs/mcp-go/mcp"
|
||||
"github.com/mark3labs/mcp-go/server"
|
||||
)
|
||||
|
||||
var _ IMcpController = (*imlMcpController)(nil)
|
||||
|
||||
type imlMcpController struct {
|
||||
settingModule system.ISettingModule `autowired:""`
|
||||
mcpModule mcp.IMcpModule `autowired:""`
|
||||
sessionKeys sync.Map
|
||||
server http.Handler
|
||||
openServer http.Handler
|
||||
}
|
||||
|
||||
var mcpDefaultConfig = `{
|
||||
"mcpServers": {
|
||||
"%s": {
|
||||
"url": "%s"
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
func (i *imlMcpController) GlobalMCPConfig(ctx *gin.Context) (string, error) {
|
||||
cfg := i.settingModule.Get(ctx)
|
||||
if cfg.SitePrefix == "" {
|
||||
return "", fmt.Errorf("site prefix is empty")
|
||||
}
|
||||
return fmt.Sprintf(mcpDefaultConfig, "APIPark-MCP-Server", fmt.Sprintf("%s/openapi/v1/%s/sse?apikey={your_api_key}", strings.TrimSuffix(cfg.SitePrefix, "/"), mcp_server.GlobalBasePath)), nil
|
||||
}
|
||||
|
||||
func (i *imlMcpController) OnComplete() {
|
||||
s := server.NewMCPServer("APIPark MCP Server", "1.0.0", server.WithLogging())
|
||||
s.AddTool(
|
||||
mcp2.NewTool(
|
||||
"apipark_service_list",
|
||||
mcp2.WithDescription("This tool is a standardized interface provided by the Apipark platform under the MCP (Model Context Protocol) framework, designed to retrieve metadata for all registered services in bulk. By invoking this tool, users can efficiently explore the complete list of published services and their core attributes, serving as a prerequisite for subsequent actions such as querying detailed API lists via service IDs, requesting access permissions, or integrating services."),
|
||||
mcp2.WithString("keyword", mcp2.Description("Keyword for fuzzy search")),
|
||||
),
|
||||
i.mcpModule.Services,
|
||||
)
|
||||
s.AddTool(
|
||||
mcp2.NewTool(
|
||||
"apipark_service_api_list",
|
||||
mcp2.WithDescription("This tool is a standardized MCP (Model Context Protocol) interface provided by the Apipark platform, designed to retrieve OpenAPI specification documents for all APIs under a specified service using its service ID. By invoking this tool, users gain precise access to detailed API definitions (including endpoints, parameters, request/response schemas) for debugging, integration, or client SDK generation."),
|
||||
mcp2.WithString("service", mcp2.Description("Service ID")),
|
||||
),
|
||||
i.mcpModule.APIs,
|
||||
)
|
||||
s.AddTool(
|
||||
mcp2.NewTool(
|
||||
"apipark_invoke_api",
|
||||
mcp2.WithDescription("This tool is a core MCP (Model Context Protocol) interface provided by the Apipark platform, enabling users to programmatically invoke APIs using metadata from apipark_service_api_list (API schemas). It acts as a unified gateway for executing API requests with built-in authentication, parameter validation, and error handling, returning structured responses for integration workflows."),
|
||||
mcp2.WithString("path", mcp2.Description("API path"), mcp2.Required()),
|
||||
mcp2.WithString("method", mcp2.Description("API method"), mcp2.Required()),
|
||||
mcp2.WithString("content-type", mcp2.Description("API Request Content-Type. If method is POST,PUT,PATCH, it must be set. If not set, it will be ignored.")),
|
||||
mcp2.WithObject("query", mcp2.Description("API Request query,param type is map[string]string")),
|
||||
mcp2.WithObject("header", mcp2.Description("API Request header,param type is map[string]string")),
|
||||
mcp2.WithString("body", mcp2.Description("API Request body")),
|
||||
),
|
||||
i.mcpModule.Invoke,
|
||||
)
|
||||
i.server = server.NewSSEServer(s, server.WithBasePath(fmt.Sprintf("/api/v1/%s", mcp_server.GlobalBasePath)))
|
||||
i.openServer = server.NewSSEServer(s, server.WithBasePath(fmt.Sprintf("/openapi/v1/%s", strings.Trim(mcp_server.GlobalBasePath, "/"))))
|
||||
}
|
||||
|
||||
func (i *imlMcpController) GlobalMCPHandle(ctx *gin.Context) {
|
||||
cfg := i.settingModule.Get(ctx)
|
||||
req := ctx.Request.WithContext(utils.SetGatewayInvoke(ctx.Request.Context(), cfg.InvokeAddress))
|
||||
|
||||
i.server.ServeHTTP(ctx.Writer, req)
|
||||
}
|
||||
|
||||
func (i *imlMcpController) GlobalHandleSSE(ctx *gin.Context) {
|
||||
i.handleSSE(ctx, i.openServer)
|
||||
}
|
||||
|
||||
func (i *imlMcpController) handleSSE(ctx *gin.Context, server http.Handler) {
|
||||
apikey := ctx.Request.URL.Query().Get("apikey")
|
||||
writer := &ResponseWriter{
|
||||
Writer: ctx.Writer,
|
||||
sessionId: make(chan string),
|
||||
}
|
||||
defer close(writer.sessionId)
|
||||
sessionId := ""
|
||||
go func() {
|
||||
var ok bool
|
||||
sessionId, ok = <-writer.sessionId
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
i.sessionKeys.Store(sessionId, apikey)
|
||||
}()
|
||||
server.ServeHTTP(writer, ctx.Request)
|
||||
i.sessionKeys.Delete(sessionId)
|
||||
}
|
||||
|
||||
func (i *imlMcpController) GlobalHandleMessage(ctx *gin.Context) {
|
||||
i.handleMessage(ctx, i.openServer)
|
||||
}
|
||||
|
||||
func (i *imlMcpController) MCPHandle(ctx *gin.Context) {
|
||||
cfg := i.settingModule.Get(ctx)
|
||||
|
||||
req := ctx.Request.WithContext(utils.SetGatewayInvoke(ctx.Request.Context(), cfg.InvokeAddress))
|
||||
mcp_server.ServeHTTP(ctx.Writer, req)
|
||||
}
|
||||
|
||||
func (i *imlMcpController) ServiceHandleSSE(ctx *gin.Context) {
|
||||
i.handleSSE(ctx, mcp_server.DefaultMCPServer())
|
||||
}
|
||||
|
||||
func (i *imlMcpController) ServiceHandleMessage(ctx *gin.Context) {
|
||||
i.handleMessage(ctx, mcp_server.DefaultMCPServer())
|
||||
}
|
||||
|
||||
func (i *imlMcpController) handleMessage(ctx *gin.Context, server http.Handler) {
|
||||
sessionId := ctx.Request.URL.Query().Get("sessionId")
|
||||
apikey, ok := i.sessionKeys.Load(sessionId)
|
||||
if !ok {
|
||||
ctx.String(403, "sessionId not found")
|
||||
return
|
||||
}
|
||||
cfg := i.settingModule.Get(ctx)
|
||||
req := ctx.Request.WithContext(utils.SetGatewayInvoke(ctx.Request.Context(), cfg.InvokeAddress))
|
||||
req = req.WithContext(utils.SetLabel(req.Context(), "apikey", apikey.(string)))
|
||||
server.ServeHTTP(ctx.Writer, req)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package mcp
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/eolinker/go-common/autowire"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type IMcpController interface {
|
||||
MCPHandle(ctx *gin.Context)
|
||||
GlobalMCPHandle(ctx *gin.Context)
|
||||
GlobalHandleSSE(ctx *gin.Context)
|
||||
GlobalHandleMessage(ctx *gin.Context)
|
||||
ServiceHandleSSE(ctx *gin.Context)
|
||||
ServiceHandleMessage(ctx *gin.Context)
|
||||
GlobalMCPConfig(ctx *gin.Context) (string, error)
|
||||
}
|
||||
|
||||
func init() {
|
||||
autowire.Auto[IMcpController](func() reflect.Value {
|
||||
return reflect.ValueOf(new(imlMcpController))
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package mcp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type ResponseWriter struct {
|
||||
Writer http.ResponseWriter
|
||||
sessionId chan string
|
||||
}
|
||||
|
||||
func (r *ResponseWriter) Flush() {
|
||||
fluster, ok := r.Writer.(http.Flusher)
|
||||
if ok {
|
||||
fluster.Flush()
|
||||
}
|
||||
}
|
||||
|
||||
func (r *ResponseWriter) Header() http.Header {
|
||||
return r.Writer.Header()
|
||||
}
|
||||
|
||||
func (r *ResponseWriter) Write(bytes []byte) (int, error) {
|
||||
re := regexp.MustCompile(`sessionId=([^&?\s]+)`)
|
||||
match := re.FindStringSubmatch(string(bytes))
|
||||
if len(match) > 1 {
|
||||
r.sessionId <- match[1]
|
||||
}
|
||||
return r.Writer.Write(bytes)
|
||||
}
|
||||
|
||||
func (r *ResponseWriter) WriteHeader(statusCode int) {
|
||||
r.Writer.WriteHeader(statusCode)
|
||||
}
|
||||
@@ -296,7 +296,7 @@ func (i *imlServiceController) editAIService(ctx *gin.Context, id string, input
|
||||
if input.Provider == nil {
|
||||
return nil, fmt.Errorf("provider is required")
|
||||
}
|
||||
if *input.Provider != "ollama" {
|
||||
if *input.Provider != ai_provider_local.ProviderLocal {
|
||||
_, has := model_runtime.GetProvider(*input.Provider)
|
||||
if !has {
|
||||
return nil, fmt.Errorf("provider not found")
|
||||
@@ -330,7 +330,7 @@ func (i *imlServiceController) createAIService(ctx *gin.Context, teamID string,
|
||||
modelId := ""
|
||||
modelCfg := ""
|
||||
modelType := "online"
|
||||
if *input.Provider == "ollama" {
|
||||
if *input.Provider == ai_provider_local.ProviderLocal {
|
||||
modelType = "local"
|
||||
list, err := i.aiLocalModel.SimpleList(ctx)
|
||||
if err != nil {
|
||||
@@ -340,7 +340,7 @@ func (i *imlServiceController) createAIService(ctx *gin.Context, teamID string,
|
||||
return nil, fmt.Errorf("no local model")
|
||||
}
|
||||
modelId = list[0].Id
|
||||
modelCfg = ai_provider_local.OllamaConfig
|
||||
modelCfg = ai_provider_local.LocalConfig
|
||||
} else {
|
||||
pv, err := i.providerModule.Provider(ctx, *input.Provider)
|
||||
if err != nil {
|
||||
@@ -354,7 +354,8 @@ func (i *imlServiceController) createAIService(ctx *gin.Context, teamID string,
|
||||
if !has {
|
||||
return nil, fmt.Errorf("model %s not found", pv.DefaultLLM)
|
||||
}
|
||||
modelId = m.ID()
|
||||
//modelId = m.ID()
|
||||
modelId = m.Name()
|
||||
modelCfg = m.DefaultConfig()
|
||||
|
||||
}
|
||||
@@ -367,7 +368,7 @@ func (i *imlServiceController) createAIService(ctx *gin.Context, teamID string,
|
||||
return err
|
||||
}
|
||||
prefix := strings.Replace(input.Prefix, ":", "_", -1)
|
||||
path := fmt.Sprintf("/%s/chat", strings.Trim(prefix, "/"))
|
||||
path := fmt.Sprintf("/%s/chat/completions", strings.Trim(prefix, "/"))
|
||||
timeout := 300000
|
||||
retry := 0
|
||||
aiPrompt := &ai_api_dto.AiPrompt{
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package system_apikey
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
system_apikey_dto "github.com/APIParkLab/APIPark/module/system-apikey/dto"
|
||||
"github.com/eolinker/go-common/autowire"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type IAPIKeyController interface {
|
||||
Create(ctx *gin.Context, input *system_apikey_dto.Create) error
|
||||
Update(ctx *gin.Context, id string, input *system_apikey_dto.Update) error
|
||||
Delete(ctx *gin.Context, id string) error
|
||||
Get(ctx *gin.Context, id string) (*system_apikey_dto.APIKey, error)
|
||||
Search(ctx *gin.Context, keyword string) ([]*system_apikey_dto.Item, error)
|
||||
SimpleList(ctx *gin.Context) ([]*system_apikey_dto.SimpleItem, error)
|
||||
MyAPIKeys(ctx *gin.Context) ([]*system_apikey_dto.SimpleItem, error)
|
||||
}
|
||||
|
||||
func init() {
|
||||
autowire.Auto[IAPIKeyController](func() reflect.Value {
|
||||
return reflect.ValueOf(new(imlAPIKeyController))
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package system_apikey
|
||||
|
||||
import (
|
||||
system_apikey "github.com/APIParkLab/APIPark/module/system-apikey"
|
||||
system_apikey_dto "github.com/APIParkLab/APIPark/module/system-apikey/dto"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
var _ IAPIKeyController = new(imlAPIKeyController)
|
||||
|
||||
type imlAPIKeyController struct {
|
||||
apikeyModule system_apikey.IAPIKeyModule `autowired:""`
|
||||
}
|
||||
|
||||
func (i *imlAPIKeyController) MyAPIKeys(ctx *gin.Context) ([]*system_apikey_dto.SimpleItem, error) {
|
||||
return i.apikeyModule.MyAPIKeys(ctx)
|
||||
}
|
||||
|
||||
func (i *imlAPIKeyController) Create(ctx *gin.Context, input *system_apikey_dto.Create) error {
|
||||
return i.apikeyModule.Create(ctx, input)
|
||||
}
|
||||
|
||||
func (i *imlAPIKeyController) Update(ctx *gin.Context, id string, input *system_apikey_dto.Update) error {
|
||||
return i.apikeyModule.Update(ctx, id, input)
|
||||
}
|
||||
|
||||
func (i *imlAPIKeyController) Delete(ctx *gin.Context, id string) error {
|
||||
return i.apikeyModule.Delete(ctx, id)
|
||||
}
|
||||
|
||||
func (i *imlAPIKeyController) Get(ctx *gin.Context, id string) (*system_apikey_dto.APIKey, error) {
|
||||
return i.apikeyModule.Get(ctx, id)
|
||||
}
|
||||
|
||||
func (i *imlAPIKeyController) Search(ctx *gin.Context, keyword string) ([]*system_apikey_dto.Item, error) {
|
||||
return i.apikeyModule.Search(ctx, keyword)
|
||||
}
|
||||
|
||||
func (i *imlAPIKeyController) SimpleList(ctx *gin.Context) ([]*system_apikey_dto.SimpleItem, error) {
|
||||
return i.apikeyModule.SimpleList(ctx)
|
||||
}
|
||||
@@ -395,36 +395,36 @@ func (i *imlInitController) createAIService(ctx context.Context, teamID string,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
path := fmt.Sprintf("/%s/demo_translation_api", strings.Trim(input.Prefix, "/"))
|
||||
path := fmt.Sprintf("/%s/chat/completions", strings.Trim(input.Prefix, "/"))
|
||||
timeout := 300000
|
||||
retry := 0
|
||||
aiPrompt := &ai_api_dto.AiPrompt{
|
||||
Variables: []*ai_api_dto.AiPromptVariable{
|
||||
{
|
||||
Key: "source_lang",
|
||||
Description: "",
|
||||
Require: true,
|
||||
},
|
||||
{
|
||||
Key: "target_lang",
|
||||
Description: "",
|
||||
Require: true,
|
||||
},
|
||||
{
|
||||
Key: "text",
|
||||
Description: "",
|
||||
Require: true,
|
||||
},
|
||||
},
|
||||
Prompt: "You need to translate {{source_lang}} into {{target_lang}}, and the following is the content that needs to be translated.\n---\n{{text}}",
|
||||
//Variables: []*ai_api_dto.AiPromptVariable{
|
||||
// {
|
||||
// Key: "source_lang",
|
||||
// Description: "",
|
||||
// Require: true,
|
||||
// },
|
||||
// {
|
||||
// Key: "target_lang",
|
||||
// Description: "",
|
||||
// Require: true,
|
||||
// },
|
||||
// {
|
||||
// Key: "text",
|
||||
// Description: "",
|
||||
// Require: true,
|
||||
// },
|
||||
//},
|
||||
//Prompt: "You need to translate {{source_lang}} into {{target_lang}}, and the following is the content that needs to be translated.\n---\n{{text}}",
|
||||
}
|
||||
aiModel := &ai_api_dto.AiModel{
|
||||
Id: m.ID(),
|
||||
Config: m.DefaultConfig(),
|
||||
Provider: providerId,
|
||||
}
|
||||
name := "Demo Translation API"
|
||||
description := "A demo that shows you how to use a prompt to create a Translation API."
|
||||
name := "Demo Chat API"
|
||||
description := "A demo that shows you how to use a prompt to create a Chat API."
|
||||
apiId := uuid.New().String()
|
||||
err = i.aiAPIModule.Create(
|
||||
ctx,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { App, Col, Form, Input, Row, Table, Tooltip } from 'antd'
|
||||
import { forwardRef, useEffect, useImperativeHandle, useMemo } from 'react'
|
||||
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react'
|
||||
import {
|
||||
PublishApprovalInfoType,
|
||||
PublishApprovalModalHandle,
|
||||
@@ -36,6 +36,7 @@ export const PublishApprovalModalContent = forwardRef<PublishApprovalModalHandle
|
||||
const [form] = Form.useForm()
|
||||
const { fetchData } = useFetch()
|
||||
const { state } = useGlobalContext()
|
||||
const versionInputRef = useRef<Input>(null)
|
||||
|
||||
const save: (operate: 'pass' | 'refuse') => Promise<boolean | string> = (operate) => {
|
||||
if (type === 'view') {
|
||||
@@ -140,6 +141,12 @@ export const PublishApprovalModalContent = forwardRef<PublishApprovalModalHandle
|
||||
|
||||
useEffect(() => {
|
||||
form.setFieldsValue({ opinion: '', ...data })
|
||||
// 如果是添加模式且insidePage为true,自动聚焦版本号输入框
|
||||
if (type === 'add' && insidePage && versionInputRef.current) {
|
||||
setTimeout(() => {
|
||||
versionInputRef.current?.focus()
|
||||
}, 100)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const translatedUpstreamColumns = useMemo(
|
||||
@@ -335,7 +342,12 @@ export const PublishApprovalModalContent = forwardRef<PublishApprovalModalHandle
|
||||
{insidePage && (
|
||||
<>
|
||||
<Form.Item label={$t('版本号')} name="version" rules={[{ required: true, whitespace: true }]}>
|
||||
<Input className="w-INPUT_NORMAL" disabled={type !== 'add'} placeholder={$t(PLACEHOLDER.input)} />
|
||||
<Input
|
||||
className="w-INPUT_NORMAL"
|
||||
disabled={type !== 'add'}
|
||||
placeholder={$t(PLACEHOLDER.input)}
|
||||
ref={versionInputRef}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label={$t('版本说明')} name="versionRemark">
|
||||
|
||||
@@ -91,8 +91,15 @@ const AIProviderSelect: React.FC<AIProviderSelectProps> = ({ value, onChange, so
|
||||
label: (
|
||||
<Space className="flex items-center">
|
||||
<span
|
||||
className="flex items-center h-[20px] w-[20px]"
|
||||
dangerouslySetInnerHTML={{ __html: provider.logo }}
|
||||
className="flex items-center justify-center h-[20px] w-[20px] overflow-hidden"
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
}}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: provider.logo.replace(/<svg/, '<svg style="max-width:100%;max-height:100%;width:auto;height:auto;"')
|
||||
}}
|
||||
></span>
|
||||
<span>{provider.name}</span>
|
||||
</Space>
|
||||
|
||||
@@ -19,11 +19,11 @@ export const AI_SERVICE_ROUTER_TABLE_COLUMNS: PageProColumns<AiServiceRouterTabl
|
||||
},
|
||||
{
|
||||
title: '模型',
|
||||
dataIndex: ['model', 'logo'],
|
||||
dataIndex: ['model', 'name'],
|
||||
ellipsis: true,
|
||||
render: (_: React.ReactNode, entity: AiServiceRouterTableListItem) => (
|
||||
<div className="flex items-center gap-[2px] ">
|
||||
<span>{entity.model.id}</span>
|
||||
<span>{entity.model.name}</span>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
|
||||
@@ -104,6 +104,7 @@ export type AiServiceRouterTableListItem = {
|
||||
model:{
|
||||
id:string
|
||||
logo:string
|
||||
name:string
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -666,6 +666,15 @@ p{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.apipark-layout-base-menu-horizontal-menu-item {
|
||||
padding-right: 0px !important;
|
||||
padding-left: 0px !important;
|
||||
}
|
||||
.apipark-layout-base-menu-horizontal-item-title {
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
.ant-pro-table-list-toolbar-setting-items{
|
||||
position:absolute;
|
||||
top:18px;
|
||||
|
||||
@@ -80,7 +80,7 @@ const AiServiceInsideRouterCreate = () => {
|
||||
timeout,
|
||||
retry,
|
||||
aiPrompt: { variables: variables, prompt: prompt },
|
||||
aiModel: { id: defaultLlm?.id, provider: defaultLlm?.provider, config: defaultLlm?.config, type: defaultLlm?.type },
|
||||
aiModel: { id: defaultLlm?.id, provider: defaultLlm?.provider, config: defaultLlm?.config, type: defaultLlm?.type, name: defaultLlm?.name },
|
||||
disabled
|
||||
}
|
||||
return fetchData<BasicResponse<null>>('service/ai-router', {
|
||||
@@ -162,7 +162,8 @@ const AiServiceInsideRouterCreate = () => {
|
||||
provider: aiModel?.provider,
|
||||
id: aiModel?.id,
|
||||
config: aiModel.config,
|
||||
type: aiModel?.type
|
||||
type: aiModel?.type,
|
||||
name: aiModel?.name
|
||||
}) as AiProviderDefaultConfig & { config: string }
|
||||
)
|
||||
getDefaultModelConfig({
|
||||
@@ -216,8 +217,8 @@ const AiServiceInsideRouterCreate = () => {
|
||||
provider: localId,
|
||||
name: aiServiceInfo?.name,
|
||||
config: llmSetting?.defaultConfig || '',
|
||||
...(llmSetting ?? {}),
|
||||
type: 'local',
|
||||
...(llmSetting ?? {})
|
||||
} as AiProviderDefaultConfig & { config: string }
|
||||
})
|
||||
}
|
||||
@@ -229,7 +230,8 @@ const AiServiceInsideRouterCreate = () => {
|
||||
return {
|
||||
...prev,
|
||||
logo: llmSetting?.logo,
|
||||
scopes: llmSetting?.scopes
|
||||
scopes: llmSetting?.scopes,
|
||||
name: llmSetting?.name
|
||||
} as AiProviderDefaultConfig & { config: string }
|
||||
})
|
||||
}
|
||||
@@ -259,8 +261,8 @@ const AiServiceInsideRouterCreate = () => {
|
||||
provider: data.provider.id,
|
||||
name: data.provider.name,
|
||||
config: llmSetting?.config || '',
|
||||
...(llmSetting ?? {}),
|
||||
type: 'online',
|
||||
...(llmSetting ?? {})
|
||||
} as AiProviderDefaultConfig & { config: string }
|
||||
})
|
||||
}
|
||||
@@ -272,7 +274,8 @@ const AiServiceInsideRouterCreate = () => {
|
||||
return {
|
||||
...prev,
|
||||
logo: llmSetting?.logo,
|
||||
scopes: llmSetting?.scopes
|
||||
scopes: llmSetting?.scopes,
|
||||
name: llmSetting?.name
|
||||
} as AiProviderDefaultConfig & { config: string }
|
||||
})
|
||||
}
|
||||
@@ -385,7 +388,7 @@ const AiServiceInsideRouterCreate = () => {
|
||||
className="flex items-center h-[24px] ai-setting-svg-container "
|
||||
dangerouslySetInnerHTML={{ __html: defaultLlm?.logo || '' }}
|
||||
></span>
|
||||
<span>{defaultLlm?.id || defaultLlm?.defaultLlm}</span>
|
||||
<span>{defaultLlm?.name || defaultLlm?.id || defaultLlm?.defaultLlm}</span>
|
||||
{defaultLlm?.scopes?.map((x) => <Tag>{x?.toLocaleUpperCase()}</Tag>)}
|
||||
</div>
|
||||
</Button>
|
||||
|
||||
@@ -10,7 +10,7 @@ import { DefaultOptionType } from 'antd/es/select'
|
||||
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react'
|
||||
|
||||
export type AiServiceRouterModelConfigHandle = {
|
||||
save: () => Promise<{ id: string; config: string, type: string, provider: string }>
|
||||
save: () => Promise<{ id: string; config: string; type: string; provider: string }>
|
||||
}
|
||||
|
||||
export type AiServiceRouterModelConfigProps = {
|
||||
@@ -49,7 +49,7 @@ const AiServiceRouterModelConfig = forwardRef<AiServiceRouterModelConfigHandle,
|
||||
|
||||
/**
|
||||
* 获取本地模型列表
|
||||
* @param setDefaultValue
|
||||
* @param setDefaultValue
|
||||
*/
|
||||
const getLocalLlmList = (setDefaultValue?: boolean) => {
|
||||
fetchData<LocalLlmType[]>('simple/ai/models/local/configured', {
|
||||
@@ -113,12 +113,11 @@ const AiServiceRouterModelConfig = forwardRef<AiServiceRouterModelConfigHandle,
|
||||
const { code, data, msg } = response
|
||||
if (code === STATUS_CODE.SUCCESS) {
|
||||
setProviderList(
|
||||
data.providers
|
||||
?.map((x: SimpleAiProviderItem) => {
|
||||
return { ...x, label: x.name, value: x.id }
|
||||
})
|
||||
data.providers?.map((x: SimpleAiProviderItem) => {
|
||||
return { ...x, label: x.name, value: x.id }
|
||||
})
|
||||
)
|
||||
if (setDefaultValue && data.providers.length) {
|
||||
if (setDefaultValue && data.providers.length) {
|
||||
const id = data.providers[0].id
|
||||
form.setFieldValue('provider', id)
|
||||
getLlmList(id)
|
||||
@@ -179,9 +178,14 @@ const AiServiceRouterModelConfig = forwardRef<AiServiceRouterModelConfigHandle,
|
||||
rules={[{ required: true }]}
|
||||
>
|
||||
<Select
|
||||
showSearch
|
||||
className="w-INPUT_NORMAL"
|
||||
filterOption={(input, option) => (option?.searchText ?? '').includes(input.toLowerCase())}
|
||||
placeholder={$t(PLACEHOLDER.select)}
|
||||
options={providerList}
|
||||
options={providerList.map((x) => ({
|
||||
...x,
|
||||
searchText: x.name.toLowerCase()
|
||||
}))}
|
||||
onChange={(e) => {
|
||||
getLlmList(e)
|
||||
}}
|
||||
@@ -191,19 +195,20 @@ const AiServiceRouterModelConfig = forwardRef<AiServiceRouterModelConfigHandle,
|
||||
|
||||
<Form.Item<AiServiceRouterModelConfigField> label={$t('模型')} name="id" rules={[{ required: true }]}>
|
||||
<Select
|
||||
showSearch
|
||||
className="w-INPUT_NORMAL"
|
||||
placeholder={$t(PLACEHOLDER.select)}
|
||||
options={
|
||||
llmList?.map((x) => ({
|
||||
value: x.id,
|
||||
label: (
|
||||
<div className="flex items-center gap-[10px]" key={x.id}>
|
||||
<span>{x.name || x.id}</span>
|
||||
{modelType === 'online' && x?.scopes?.map((s: any) => <Tag>{s?.toLocaleUpperCase()}</Tag>)}
|
||||
</div>
|
||||
)
|
||||
}))
|
||||
}
|
||||
filterOption={(input, option) => (option?.searchText ?? '').includes(input.toLowerCase())}
|
||||
options={llmList?.map((x) => ({
|
||||
value: x.id,
|
||||
label: (
|
||||
<div className="flex items-center gap-[10px]" key={x.id}>
|
||||
<span>{x.name || x.id}</span>
|
||||
{modelType === 'online' && x?.scopes?.map((s: any) => <Tag>{s?.toLocaleUpperCase()}</Tag>)}
|
||||
</div>
|
||||
),
|
||||
searchText: x.name.toLowerCase()
|
||||
}))}
|
||||
onChange={(e) => {
|
||||
form.setFieldValue('config', llmList.find((x) => x.id === e)?.config)
|
||||
}}
|
||||
|
||||
@@ -283,8 +283,9 @@ const AiSettingModalContent = forwardRef<AiSettingModalContentHandle, AiSettingM
|
||||
),
|
||||
onOk: () => {
|
||||
return addModelModalRef.current?.save().then((res) => {
|
||||
if (res === true) {
|
||||
if (res) {
|
||||
getLlmList(lastLlmID)
|
||||
form.setFieldValue('defaultLlm', res)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -87,7 +87,7 @@ const OnlineModelList: React.FC = () => {
|
||||
keyword: searchWord,
|
||||
page: params.current
|
||||
},
|
||||
eoTransformKeys: ['default_llm', 'api_count', 'key_count', 'model_count', 'can_delete']
|
||||
eoTransformKeys: ['default_llm', 'default_llm_name', 'api_count', 'key_count', 'model_count', 'can_delete']
|
||||
})
|
||||
|
||||
if (response.code === STATUS_CODE.SUCCESS) {
|
||||
@@ -195,7 +195,7 @@ const OnlineModelList: React.FC = () => {
|
||||
{
|
||||
title: $t('默认模型'),
|
||||
ellipsis: true,
|
||||
dataIndex: 'defaultLlm'
|
||||
dataIndex: 'defaultLlmName'
|
||||
},
|
||||
{
|
||||
title: $t('Models'),
|
||||
|
||||
@@ -102,7 +102,7 @@ const AddModels = forwardRef<addModelsContentHandle, addModelContentProps>((prop
|
||||
...value,
|
||||
id: modelID
|
||||
}
|
||||
fetchData<BasicResponse<null>>('ai/provider/model', {
|
||||
fetchData<BasicResponse<{ model: { id: string, name: string } }>>('ai/provider/model', {
|
||||
method: type === 'edit' ? 'PUT' : 'POST',
|
||||
eoParams: { provider: providerID },
|
||||
eoBody: finalValue,
|
||||
@@ -112,7 +112,8 @@ const AddModels = forwardRef<addModelsContentHandle, addModelContentProps>((prop
|
||||
const { code, msg } = response
|
||||
if (code === STATUS_CODE.SUCCESS) {
|
||||
message.success($t(RESPONSE_TIPS.success) || msg)
|
||||
resolve(true)
|
||||
const llmId = response.data?.model?.id
|
||||
resolve(llmId)
|
||||
} else {
|
||||
message.error(msg || $t(RESPONSE_TIPS.error))
|
||||
reject(msg || $t(RESPONSE_TIPS.error))
|
||||
|
||||
@@ -57,11 +57,13 @@ const ModelsDetailTable = (props: { providerID?: string }) => {
|
||||
{
|
||||
title: $t('模型名称'),
|
||||
ellipsis: true,
|
||||
copyable: true,
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: $t('模型类型'),
|
||||
ellipsis: true,
|
||||
width: 100,
|
||||
dataIndex: 'type'
|
||||
},
|
||||
{
|
||||
@@ -78,6 +80,7 @@ const ModelsDetailTable = (props: { providerID?: string }) => {
|
||||
</span>
|
||||
),
|
||||
ellipsis: true,
|
||||
copyable: true,
|
||||
dataIndex: 'modelValue'
|
||||
},
|
||||
...operation
|
||||
@@ -153,7 +156,7 @@ const ModelsDetailTable = (props: { providerID?: string }) => {
|
||||
const tableData = response.data.llms.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
modelValue: `${response.data.provider.name}/${item.name}`
|
||||
modelValue: `${response.data.provider.id}/${item.name}`
|
||||
}
|
||||
})
|
||||
return {
|
||||
|
||||
@@ -26,7 +26,7 @@ const ApiKeyContent: React.FC<ApiKeyContentProps> = forwardRef(({ provider, enti
|
||||
form.setFieldsValue({
|
||||
name: entity.name,
|
||||
expire_time: isNeverExpire ? undefined : dayjs(entity.expire_time * 1000),
|
||||
config: entity.config
|
||||
config: entity.config ? JSON.stringify(JSON.parse(entity.config), null, 2) : ''
|
||||
})
|
||||
} catch (e) {
|
||||
form.setFieldsValue({
|
||||
|
||||
@@ -182,7 +182,9 @@ const AddLoadBalancingModel = forwardRef<LoadBalancingHandle>((props, ref: any)
|
||||
{modelType === 'online' && (
|
||||
<Form.Item<LoadModelDetailData> label={$t('模型供应商')} name="provider" rules={[{ required: true }]}>
|
||||
<Select
|
||||
showSearch
|
||||
className="w-INPUT_NORMAL"
|
||||
filterOption={(input, option) => (option?.searchText ?? '').includes(input.toLowerCase())}
|
||||
placeholder={$t(PLACEHOLDER.select)}
|
||||
loading={modelProviderLoading}
|
||||
options={modelProviderData?.map((x) => ({
|
||||
@@ -191,7 +193,8 @@ const AddLoadBalancingModel = forwardRef<LoadBalancingHandle>((props, ref: any)
|
||||
<div className="flex items-center gap-[10px]">
|
||||
<span>{x.name}</span>
|
||||
</div>
|
||||
)
|
||||
),
|
||||
searchText: x.name.toLowerCase()
|
||||
}))}
|
||||
onChange={(e) => {
|
||||
modelProviderChange(e)
|
||||
@@ -201,8 +204,10 @@ const AddLoadBalancingModel = forwardRef<LoadBalancingHandle>((props, ref: any)
|
||||
)}
|
||||
<Form.Item label={$t('模型')} name="model" className="mt-[16px]" rules={[{ required: true }]}>
|
||||
<Select
|
||||
showSearch
|
||||
className="w-INPUT_NORMAL"
|
||||
placeholder={$t(PLACEHOLDER.input)}
|
||||
filterOption={(input, option) => (option?.searchText ?? '').includes(input.toLowerCase())}
|
||||
loading={llmListLoading}
|
||||
options={
|
||||
llmList?.map((x) => ({
|
||||
@@ -212,7 +217,8 @@ const AddLoadBalancingModel = forwardRef<LoadBalancingHandle>((props, ref: any)
|
||||
<span>{x.name || x.id}</span>
|
||||
{ modelType === 'online' &&x?.scopes?.map((s: any) => <Tag key={s}>{s?.toLocaleUpperCase()}</Tag>)}
|
||||
</div>
|
||||
)
|
||||
),
|
||||
searchText: x.name.toLowerCase()
|
||||
}))
|
||||
}
|
||||
onChange={(value) => {
|
||||
|
||||
@@ -40,7 +40,7 @@ const LogSettings = () => {
|
||||
const menuData = useMemo(() => {
|
||||
const newMenu = menuItems?.map((x: DynamicMenuItem) => {
|
||||
return getItem(
|
||||
<Link to={`template/${x.name}`}>{$t(x.title)}</Link>,
|
||||
<Link to={`/logsettings/template/${x.name}`}>{$t(x.title)}</Link>,
|
||||
x.name,
|
||||
undefined,
|
||||
undefined,
|
||||
|
||||
@@ -138,7 +138,7 @@ const SystemConfig = forwardRef<SystemConfigHandle>((_, ref) => {
|
||||
const { code, data, msg } = response
|
||||
if (code === STATUS_CODE.SUCCESS) {
|
||||
const localModelList = data.llms?.map((x: any) => {
|
||||
return { ...x, label: x.id, value: x.id }
|
||||
return { ...x, label: x.name || x.id, value: x.id }
|
||||
})
|
||||
setModelList(localModelList)
|
||||
if (setDefaultLlm && localModelList.length > 0) {
|
||||
@@ -450,9 +450,14 @@ const SystemConfig = forwardRef<SystemConfigHandle>((_, ref) => {
|
||||
>
|
||||
{providerOptionList && providerOptionList.length > 0 ? (
|
||||
<Select
|
||||
showSearch
|
||||
className="w-INPUT_NORMAL"
|
||||
filterOption={(input, option) => (option?.searchText ?? '').includes(input.toLowerCase())}
|
||||
placeholder={$t(PLACEHOLDER.input)}
|
||||
options={providerOptionList}
|
||||
options={providerOptionList.map((x) => ({
|
||||
...x,
|
||||
searchText: x.name.toLowerCase()
|
||||
}))}
|
||||
onChange={(e) => {
|
||||
modelProviderChange(e)
|
||||
}}
|
||||
@@ -467,7 +472,16 @@ const SystemConfig = forwardRef<SystemConfigHandle>((_, ref) => {
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item<AiServiceConfigFieldType> label={$t('默认模型')} name="model" rules={[{ required: true }]}>
|
||||
<Select className="w-INPUT_NORMAL" placeholder={$t(PLACEHOLDER.input)} options={modelList}></Select>
|
||||
<Select
|
||||
showSearch
|
||||
filterOption={(input, option) => (option?.searchText ?? '').includes(input.toLowerCase())}
|
||||
className="w-INPUT_NORMAL"
|
||||
placeholder={$t(PLACEHOLDER.input)}
|
||||
options={modelList ? modelList.map((x) => ({
|
||||
...x,
|
||||
searchText: x.name.toLowerCase()
|
||||
})) : []}
|
||||
></Select>
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -14,6 +14,10 @@ type ClientDriver struct {
|
||||
client admin_client.Client
|
||||
}
|
||||
|
||||
func (c *ClientDriver) Hash() gateway.IHashClient {
|
||||
return NewHashClient(c.client)
|
||||
}
|
||||
|
||||
func (c *ClientDriver) Strategy() gateway.IStrategyClient {
|
||||
return NewStrategyClient(c.client)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package apinto
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/APIParkLab/APIPark/gateway"
|
||||
admin_client "github.com/eolinker/eosc/process-admin/client"
|
||||
)
|
||||
|
||||
var _ gateway.IHashClient = &HashClient{}
|
||||
|
||||
type HashClient struct {
|
||||
client admin_client.Client
|
||||
}
|
||||
|
||||
func (s *HashClient) Online(ctx context.Context, resources ...*gateway.HashRelease) error {
|
||||
s.client.Begin(ctx)
|
||||
for _, r := range resources {
|
||||
// 先删除所有,再set
|
||||
err := s.client.HDelAll(ctx, r.HashKey)
|
||||
if err != nil {
|
||||
s.client.Rollback(ctx)
|
||||
return err
|
||||
}
|
||||
for key, value := range r.HashMap {
|
||||
err := s.client.HSet(ctx, r.HashKey, key, value)
|
||||
if err != nil {
|
||||
s.client.Rollback(ctx)
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return s.client.Commit(ctx)
|
||||
}
|
||||
|
||||
func (s *HashClient) Offline(ctx context.Context, resources ...*gateway.HashRelease) error {
|
||||
s.client.Begin(ctx)
|
||||
for _, r := range resources {
|
||||
if len(r.HashMap) == 0 {
|
||||
err := s.client.HDelAll(ctx, r.HashKey)
|
||||
if err != nil {
|
||||
s.client.Rollback(ctx)
|
||||
return err
|
||||
}
|
||||
}
|
||||
for key, _ := range r.HashMap {
|
||||
err := s.client.HDel(ctx, r.HashKey, key)
|
||||
if err != nil {
|
||||
s.client.Rollback(ctx)
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return s.client.Commit(ctx)
|
||||
}
|
||||
|
||||
func NewHashClient(client admin_client.Client) *HashClient {
|
||||
return &HashClient{client: client}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ type IClientDriver interface {
|
||||
Subscribe() ISubscribeClient
|
||||
Strategy() IStrategyClient
|
||||
Dynamic(resource string) (IDynamicClient, error)
|
||||
Hash() IHashClient
|
||||
PluginSetting() IPluginSetting
|
||||
Commit(ctx context.Context) error
|
||||
Rollback(ctx context.Context) error
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package gateway
|
||||
|
||||
const KeyServiceMapping = "service_mapping"
|
||||
@@ -70,6 +70,10 @@ var dynamicResourceMap = map[string]Worker{
|
||||
Profession: ProfessionAIResource,
|
||||
Driver: "ai-key",
|
||||
},
|
||||
"ai-model": {
|
||||
Profession: ProfessionAIResource,
|
||||
Driver: "ai-model",
|
||||
},
|
||||
}
|
||||
|
||||
type Worker struct {
|
||||
|
||||
@@ -15,6 +15,8 @@ type IApplicationClient IResourceClient[ApplicationRelease]
|
||||
|
||||
type IServiceClient IResourceClient[ServiceRelease]
|
||||
|
||||
type IHashClient IResourceClient[HashRelease]
|
||||
|
||||
type ISubscribeClient IResourceClient[SubscribeRelease]
|
||||
|
||||
type IStrategyClient IResourceClient[eosc.Base[StrategyRelease]]
|
||||
@@ -133,6 +135,11 @@ type ServiceRelease struct {
|
||||
Apis []string
|
||||
}
|
||||
|
||||
type HashRelease struct {
|
||||
HashKey string
|
||||
HashMap map[string]string
|
||||
}
|
||||
|
||||
type SubscribeRelease struct {
|
||||
// 订阅服务ID
|
||||
Service string
|
||||
|
||||