Merge branch 'APIParkLab:main' into main

This commit is contained in:
JackLiu
2024-10-25 14:31:26 +08:00
committed by GitHub
59 changed files with 444 additions and 178 deletions
+98
View File
@@ -0,0 +1,98 @@
variables:
PATH: /opt/go-1.21/go/bin/:/opt/node/node/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
GOROOT: /opt/go-1.21/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
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
+4 -2
View File
@@ -21,8 +21,10 @@ type Provider struct {
Help Help `json:"help" yaml:"help"`
SupportedModelTypes []string `json:"supported_model_types" yaml:"supported_model_types"`
ProviderCredentialSchema ProviderCredentialSchema `json:"provider_credential_schema" yaml:"provider_credential_schema"`
Default map[string]string `json:"default"`
Address string `json:"address"`
Default map[string]string `json:"default" yaml:"default"`
Address string `json:"address" yaml:"address"`
Recommend bool `json:"recommend" yaml:"recommend"`
Sort int `json:"sort" yaml:"sort"`
}
type ProviderCredentialSchema struct {
+10 -1
View File
@@ -1,6 +1,8 @@
package model_runtime
import "github.com/eolinker/eosc"
import (
"github.com/eolinker/eosc"
)
var (
defaultManager = NewManager()
@@ -27,6 +29,13 @@ func (m *Manager) Del(name string) {
}
func (m *Manager) List() []IProvider {
//list := m.providers.List()
//sort.Slice(list, func(i, j int) bool {
// if list[i].Sort() == list[j].Sort() {
// return list[i].ID() < list[j].ID()
// }
// return list[i].Sort() < list[j].Sort()
//})
return m.providers.List()
}
@@ -38,3 +38,5 @@ provider_credential_schema:
zh_Hans: 在此输入您的 API URL
en_US: Enter your API URL
address: https://api.anthropic.com
recommend: true
sort: 2
@@ -1,6 +1,6 @@
provider: bedrock
label:
en_US: AWS
en_US: AWS Bedrock
description:
en_US: AWS Bedrock's models.
icon_small:
@@ -87,4 +87,6 @@ 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)
address: https://bedrock-runtime.amazonaws.com
address: https://bedrock-runtime.amazonaws.com
sort: 4
recommend: true
@@ -1,3 +1,3 @@
<svg width="60" height="50" viewBox="0 0 60 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<svg width="50" height="50" viewBox="0 0 50 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path id="path" d="M55.613,3.471C55.018,3.179 54.761,3.735 54.413,4.018C54.294,4.109 54.193,4.227 54.092,4.337C53.222,5.266 52.206,5.876 50.878,5.803C48.936,5.694 47.278,6.305 45.813,7.79C45.501,5.959 44.466,4.865 42.891,4.164C42.067,3.799 41.233,3.435 40.656,2.642C40.253,2.077 40.143,1.448 39.942,0.829C39.814,0.455 39.685,0.073 39.255,0.009C38.788,-0.064 38.605,0.328 38.421,0.656C37.689,1.995 37.405,3.471 37.432,4.965C37.496,8.327 38.916,11.006 41.737,12.91C42.058,13.129 42.14,13.347 42.039,13.666C41.847,14.323 41.618,14.96 41.416,15.616C41.288,16.035 41.096,16.127 40.647,15.944C39.099,15.297 37.762,14.341 36.58,13.184C34.575,11.243 32.761,9.102 30.499,7.425C29.968,7.033 29.436,6.669 28.887,6.323C26.579,4.082 29.189,2.241 29.794,2.022C30.425,1.795 30.013,1.011 27.971,1.02C25.928,1.029 24.06,1.713 21.679,2.624C21.331,2.761 20.964,2.861 20.589,2.943C18.427,2.533 16.183,2.441 13.838,2.706C9.424,3.198 5.898,5.284 3.306,8.847C0.191,13.129 -0.541,17.994 0.356,23.069C1.3,28.417 4.029,32.845 8.224,36.308C12.575,39.897 17.584,41.656 23.3,41.319C26.771,41.118 30.636,40.654 34.996,36.964C36.095,37.51 37.249,37.729 39.163,37.893C40.638,38.03 42.058,37.82 43.157,37.592C44.878,37.228 44.759,35.633 44.137,35.342C39.09,32.991 40.198,33.948 39.191,33.173C41.755,30.139 45.62,26.987 47.132,16.773C47.251,15.962 47.15,15.452 47.132,14.796C47.122,14.395 47.214,14.241 47.672,14.195C48.936,14.049 50.163,13.703 51.29,13.083C54.56,11.298 55.878,8.364 56.19,4.847C56.236,4.309 56.181,3.753 55.613,3.471ZM27.119,35.123C22.228,31.278 19.856,30.012 18.876,30.066C17.96,30.121 18.125,31.169 18.326,31.852C18.537,32.526 18.812,32.991 19.196,33.583C19.462,33.975 19.645,34.558 18.931,34.996C17.356,35.971 14.617,34.667 14.489,34.604C11.301,32.727 8.636,30.249 6.758,26.859C4.945,23.597 3.892,20.099 3.718,16.363C3.672,15.461 3.938,15.142 4.835,14.979C6.017,14.76 7.235,14.714 8.416,14.887C13.408,15.616 17.658,17.848 21.221,21.384C23.254,23.397 24.793,25.802 26.377,28.153C28.062,30.649 29.876,33.028 32.184,34.977C32.999,35.661 33.649,36.18 34.272,36.563C32.395,36.772 29.262,36.818 27.119,35.123ZM29.464,20.044C29.464,19.643 29.784,19.325 30.187,19.325C30.279,19.325 30.361,19.343 30.435,19.37C30.535,19.407 30.627,19.461 30.7,19.543C30.828,19.671 30.902,19.853 30.902,20.044C30.902,20.445 30.581,20.764 30.178,20.764C29.775,20.764 29.464,20.445 29.464,20.044ZM36.745,23.78C36.278,23.971 35.811,24.135 35.362,24.153C34.666,24.19 33.906,23.907 33.494,23.561C32.853,23.023 32.395,22.723 32.202,21.784C32.12,21.384 32.166,20.764 32.239,20.409C32.404,19.643 32.221,19.151 31.68,18.705C31.241,18.34 30.682,18.24 30.068,18.24C29.839,18.24 29.629,18.14 29.473,18.058C29.216,17.93 29.006,17.612 29.207,17.22C29.271,17.092 29.583,16.783 29.656,16.728C30.49,16.254 31.451,16.409 32.34,16.764C33.164,17.101 33.787,17.721 34.684,18.596C35.6,19.652 35.765,19.944 36.287,20.737C36.7,21.356 37.075,21.994 37.331,22.723C37.487,23.179 37.286,23.552 36.745,23.78Z" style="fill:rgb(77,107,254);fill-rule:nonzero;"/>
</svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg version="1.1" id="_x32_" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="800px" height="800px" viewBox="0 0 512 512" xml:space="preserve">
<style type="text/css">
<![CDATA[
.st0{fill:#000000;}
]]>
</style>
<g>
<path class="st0" d="M485.016,220.691c12.422-8.422,22.188-57.266,7.797-87.016c-26.859,28.125-80.109,49.859-142,72.922
c-64.656,24.078-71.531,41.859-94.813,42.172c-23.297-0.313-30.156-18.094-94.813-42.172c-61.891-23.063-115.141-44.797-142-72.922
c-14.406,29.75-4.625,78.594,7.781,87.016C13.484,214.332,0,210.051,0,210.051s3.813,68.172,33.25,106.563
c24.953,32.547,86.984,72.906,145.828,58.828c62.219-14.875,62.344-41.406,76.922-41.266c14.563-0.141,14.688,26.391,76.906,41.266
c58.844,14.078,120.875-26.281,145.844-58.828C508.156,278.223,512,210.051,512,210.051S498.5,214.332,485.016,220.691z
M131.438,318.848c-25.109-11.641-46.063-37.422-43.188-73.891c12.813,5.078,48.844,9.406,69.094,17.281
c23,8.953,46.031,23.984,48.922,41.25C205.313,317.879,170.75,337.066,131.438,318.848z M380.563,318.848
c-39.344,18.219-73.875-0.969-74.828-15.359c2.891-17.266,25.891-32.297,48.922-41.25c20.25-7.875,56.281-12.203,69.094-17.281
C426.625,281.426,405.656,307.207,380.563,318.848z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg version="1.1" id="_x32_" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="800px" height="800px" viewBox="0 0 512 512" xml:space="preserve">
<style type="text/css">
<![CDATA[
.st0{fill:#000000;}
]]>
</style>
<g>
<path class="st0" d="M485.016,220.691c12.422-8.422,22.188-57.266,7.797-87.016c-26.859,28.125-80.109,49.859-142,72.922
c-64.656,24.078-71.531,41.859-94.813,42.172c-23.297-0.313-30.156-18.094-94.813-42.172c-61.891-23.063-115.141-44.797-142-72.922
c-14.406,29.75-4.625,78.594,7.781,87.016C13.484,214.332,0,210.051,0,210.051s3.813,68.172,33.25,106.563
c24.953,32.547,86.984,72.906,145.828,58.828c62.219-14.875,62.344-41.406,76.922-41.266c14.563-0.141,14.688,26.391,76.906,41.266
c58.844,14.078,120.875-26.281,145.844-58.828C508.156,278.223,512,210.051,512,210.051S498.5,214.332,485.016,220.691z
M131.438,318.848c-25.109-11.641-46.063-37.422-43.188-73.891c12.813,5.078,48.844,9.406,69.094,17.281
c23,8.953,46.031,23.984,48.922,41.25C205.313,317.879,170.75,337.066,131.438,318.848z M380.563,318.848
c-39.344,18.219-73.875-0.969-74.828-15.359c2.891-17.266,25.891-32.297,48.922-41.25c20.25-7.875,56.281-12.203,69.094-17.281
C426.625,281.426,405.656,307.207,380.563,318.848z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,30 @@
provider: fakegpt
label:
en_US: FakeGPT
description:
en_US: FakeGPT is a fake model provider that does not actually connect to any model service. It is useful for testing and development purposes.
icon_small:
en_US: icon_s_en.svg
icon_large:
en_US: icon_l_en.svg
background: "#FCFDFF"
help:
title:
en_US: Get your Access Details from Google
url:
en_US: https://apipark.com
supported_model_types:
- llm
- text-embedding
configurate_methods:
- predefined-model
provider_credential_schema:
credential_form_schemas:
- variable: apikey
label:
en_US: API Key
type: secret-input
required: true
placeholder:
en_US: Enter your API key
address: https://apipark.com
@@ -0,0 +1,51 @@
model: fakegpt-1.0
label:
en_US: FakeGPT 1.0
model_type: llm
features:
- agent-thought
- vision
model_properties:
mode: chat
context_size: 200000
parameter_rules:
- name: max_tokens
use_template: max_tokens
required: true
type: int
default: 4096
min: 1
max: 4096
help:
zh_Hans: 停止前生成的最大令牌数。
en_US: The maximum number of tokens to generate before stopping.
- name: temperature
use_template: temperature
required: false
type: float
default: 1
min: 0.0
max: 1.0
help:
zh_Hans: 生成内容的随机性。
en_US: The amount of randomness injected into the response.
- name: top_p
required: false
type: float
default: 0.999
min: 0.000
max: 1.000
help:
zh_Hans: 在核采样中,按概率递减顺序计算每个后续标记的所有选项的累积分布,并在达到 top_p 指定的特定概率时将其切断。您应该更改温度或top_p,但不能同时更改两者。
en_US: In nucleus sampling, computes the cumulative distribution over all the options for each subsequent token in decreasing probability order and cuts it off once it reaches a particular probability specified by top_p. You should alter either temperature or top_p, but not both.
- name: top_k
required: false
type: int
default: 0
min: 0
# tip docs from aws has error, max value is 500
max: 500
help:
zh_Hans: 对于每个后续标记,仅从前 K 个选项中进行采样。使用 top_k 删除长尾低概率响应。
en_US: Only sample from the top K options for each subsequent token. Use top_k to remove long tail low probability responses.
@@ -1,4 +1,4 @@
<svg width="638" height="315" viewBox="0 0 638 315" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="315" height="315" viewBox="0 0 638 315" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M318.563 221.755C300.863 221.755 284.979 211.247 278.206 194.978L196.549 0H244.342L318.842 178.361L393.273 0H441.066L358.92 195.048C352.112 211.247 336.263 221.755 318.563 221.755Z" fill="#6720FF"/>
<path d="M425.111 314.933C407.481 314.933 391.667 304.494 384.824 288.366C377.947 272.097 381.507 253.524 393.936 240.921L542.657 90.2803L561.229 134.094L425.076 271.748L619.147 270.666L637.72 314.479L425.146 315.003L425.076 314.933H425.111Z" fill="#6720FF"/>
<path d="M0 314.408L18.5727 270.595L212.643 271.677L76.525 133.988L95.0977 90.1748L243.819 240.816C256.247 253.384 259.843 272.026 252.93 288.26C246.088 304.424 230.203 314.827 212.643 314.827L0.0698221 314.339L0 314.408Z" fill="#6720FF"/>

Before

Width:  |  Height:  |  Size: 815 B

After

Width:  |  Height:  |  Size: 815 B

@@ -1,6 +1,6 @@
provider: google
label:
en_US: Google
en_US: Google Gemini
description:
en_US: Google's Gemini model.
zh_Hans: 谷歌提供的 Gemini 模型.
@@ -38,4 +38,6 @@ provider_credential_schema:
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
recommend: true
sort: 3
@@ -30,4 +30,4 @@ provider_credential_schema:
placeholder:
zh_Hans: 在此输入您的 API Key
en_US: Enter your API Key
address: https://api.openai.com
address: https://api.groq.com
@@ -27,4 +27,6 @@ provider_credential_schema:
placeholder:
zh_Hans: 在此输入您的 API Key
en_US: Enter your API Key
address: https://api.minimax.chat
address: https://api.minimax.chat
recommend: true
sort: 5
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="90px" height="82px" viewBox="0 0 90 82" enable-background="new 0 0 90 82" xml:space="preserve"> <image id="image0" width="90" height="82" x="0" y="0"
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="82px" height="82px" viewBox="0 0 82 82" enable-background="new 0 0 90 82" xml:space="preserve"> <image id="image0" width="90" height="82" x="0" y="0"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABSCAYAAADU+8NvAAAAIGNIUk0AAHomAACAhAAA+gAAAIDo
AAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAFqelRYdFJhdyBwcm9maWxl
IHR5cGUgeG1wAAA4jZ1TW26EMAz89yl6hGA7NhyHkuSvUj97/I4DXV7brlQidsGxZ8YTQ18fn/QW

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

@@ -31,4 +31,6 @@ provider_credential_schema:
placeholder:
zh_Hans: 在此输入您的 API Key
en_US: Enter your API Key
address: https://api.moonshot.cn
address: https://api.moonshot.cn
recommend: true
sort: 6
@@ -1,4 +1,4 @@
<svg width="32" height="36" viewBox="0 0 32 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="36" height="36" viewBox="0 0 32 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 0C0.895431 0 0 0.895432 0 2V29.1891C0 30.2937 0.895433 31.1891 2 31.1891H5.51171L16.0608 35.1377C16.7145 35.3824 17.4114 34.8991 17.4114 34.2012V11.3669C17.4114 10.533 16.894 9.78665 16.1131 9.49405L5.51171 5.52152H25.58V31.1891H29.0917C30.1963 31.1891 31.0917 30.2937 31.0917 29.1891V2C31.0917 0.895431 30.1963 0 29.0917 0H2ZM14.6022 23.7351C15.0558 23.956 15.4239 23.6812 15.4239 23.1185C15.4239 22.5557 15.0558 21.9204 14.6022 21.6995C14.1486 21.4775 13.7804 21.7545 13.7804 22.3161C13.7804 22.8777 14.1486 23.513 14.6022 23.7351Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 0C0.895431 0 0 0.895432 0 2V29.1891C0 30.2937 0.895433 31.1891 2 31.1891H5.51171L16.0608 35.1377C16.7145 35.3824 17.4114 34.8991 17.4114 34.2012V11.3669C17.4114 10.533 16.894 9.78665 16.1131 9.49405L5.51171 5.52152H25.58V31.1891H29.0917C30.1963 31.1891 31.0917 30.2937 31.0917 29.1891V2C31.0917 0.895431 30.1963 0 29.0917 0H2ZM14.6022 23.7351C15.0558 23.956 15.4239 23.6812 15.4239 23.1185C15.4239 22.5557 15.0558 21.9204 14.6022 21.6995C14.1486 21.4775 13.7804 21.7545 13.7804 22.3161C13.7804 22.8777 14.1486 23.513 14.6022 23.7351Z" fill="url(#paint0_linear_1473_97)"/>
<defs>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -1,3 +1,3 @@
<svg width="100" height="22" viewBox="0 0 567 376" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="22" height="22" viewBox="0 0 567 376" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M58.0366 161.868C58.0366 161.868 109.261 86.2912 211.538 78.4724V51.053C98.2528 60.1511 0.152344 156.098 0.152344 156.098C0.152344 156.098 55.7148 316.717 211.538 331.426V302.282C97.1876 287.896 58.0366 161.868 58.0366 161.868ZM211.538 244.32V271.013C125.114 255.603 101.125 165.768 101.125 165.768C101.125 165.768 142.621 119.799 211.538 112.345V141.633C211.486 141.633 211.449 141.617 211.406 141.617C175.235 137.276 146.978 171.067 146.978 171.067C146.978 171.067 162.816 227.949 211.538 244.32ZM211.538 0.47998V51.053C214.864 50.7981 218.189 50.5818 221.533 50.468C350.326 46.1273 434.243 156.098 434.243 156.098C434.243 156.098 337.861 273.296 237.448 273.296C228.245 273.296 219.63 272.443 211.538 271.009V302.282C218.695 303.201 225.903 303.667 233.119 303.675C326.56 303.675 394.134 255.954 459.566 199.474C470.415 208.162 514.828 229.299 523.958 238.55C461.745 290.639 316.752 332.626 234.551 332.626C226.627 332.626 219.018 332.148 211.538 331.426V375.369H566.701V0.47998H211.538ZM211.538 112.345V78.4724C214.829 78.2425 218.146 78.0672 221.533 77.9602C314.148 75.0512 374.909 157.548 374.909 157.548C374.909 157.548 309.281 248.693 238.914 248.693C228.787 248.693 219.707 247.065 211.536 244.318V141.631C247.591 145.987 254.848 161.914 276.524 198.049L324.737 157.398C324.737 157.398 289.544 111.243 230.219 111.243C223.768 111.241 217.597 111.696 211.538 112.345Z" fill="#77B900"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -1,6 +1,6 @@
provider: nvidia
label:
en_US: API Catalog
en_US: Nvidia
description:
en_US: API Catalog
zh_Hans: API Catalog
@@ -88,3 +88,5 @@ provider_credential_schema:
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
recommend: true
sort: 1
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 21 KiB

@@ -24,7 +24,7 @@ parameter_rules:
use_template: presence_penalty
- name: frequency_penalty
use_template: frequency_penalty
- name: max_output_tokens
- name: max_tokens
use_template: max_tokens
required: true
default: 2048
@@ -23,7 +23,7 @@ parameter_rules:
use_template: presence_penalty
- name: frequency_penalty
use_template: frequency_penalty
- name: max_output_tokens
- name: max_tokens
use_template: max_tokens
required: true
default: 8192
@@ -24,7 +24,7 @@ parameter_rules:
use_template: presence_penalty
- name: frequency_penalty
use_template: frequency_penalty
- name: max_output_tokens
- name: max_tokens
use_template: max_tokens
required: true
default: 8192
@@ -24,7 +24,7 @@ parameter_rules:
use_template: presence_penalty
- name: frequency_penalty
use_template: frequency_penalty
- name: max_output_tokens
- name: max_tokens
use_template: max_tokens
required: true
default: 8192
@@ -24,7 +24,7 @@ parameter_rules:
use_template: presence_penalty
- name: frequency_penalty
use_template: frequency_penalty
- name: max_output_tokens
- name: max_tokens
use_template: max_tokens
required: true
default: 8192
@@ -24,7 +24,7 @@ parameter_rules:
use_template: presence_penalty
- name: frequency_penalty
use_template: frequency_penalty
- name: max_output_tokens
- name: max_tokens
use_template: max_tokens
required: true
default: 8192
@@ -24,7 +24,7 @@ parameter_rules:
use_template: presence_penalty
- name: frequency_penalty
use_template: frequency_penalty
- name: max_output_tokens
- name: max_tokens
use_template: max_tokens
required: true
default: 8192
@@ -24,7 +24,7 @@ parameter_rules:
use_template: presence_penalty
- name: frequency_penalty
use_template: frequency_penalty
- name: max_output_tokens
- name: max_tokens
use_template: max_tokens
required: true
default: 8192
@@ -1,6 +1,6 @@
provider: wenxin
label:
en_US: WenXin
en_US: Wenxin YiYan
zh_Hans: 文心一言
icon_small:
en_US: icon_s_en.svg
@@ -38,4 +38,6 @@ provider_credential_schema:
placeholder:
zh_Hans: 在此输入您的 Secret Key
en_US: Enter your Secret Key
address: https://aip.baidubce.com
address: https://aip.baidubce.com
recommend: true
sort: 7
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

+19 -5
View File
@@ -22,6 +22,8 @@ type IProvider interface {
ModelsByType(modelType string) ([]IModel, bool)
IConfig
MaskConfig(cfg string) string
Sort() int
Recommend() bool
}
type IProviderURI interface {
@@ -55,10 +57,10 @@ func NewProvider(providerData string, modelContents map[string]eosc.Untyped[stri
}
delete(modelContents, DirAssets)
providerLogo, ok := assetsFiles.Get(providerCfg.IconLarge[entity.LanguageEnglish])
if !ok {
return nil, fmt.Errorf("provider logo not found:%s", providerCfg.Provider)
}
//providerLogo, ok := assetsFiles.Get(providerCfg.IconLarge[entity.LanguageEnglish])
//if !ok {
// return nil, fmt.Errorf("provider logo not found:%s", providerCfg.Provider)
//}
modelLogo, ok := assetsFiles.Get(providerCfg.IconSmall[entity.LanguageEnglish])
if !ok {
return nil, fmt.Errorf("model logo not found:%s", providerCfg.Provider)
@@ -66,12 +68,14 @@ func NewProvider(providerData string, modelContents map[string]eosc.Untyped[stri
provider := &Provider{
id: providerCfg.Provider,
name: providerCfg.Label[entity.LanguageEnglish],
logo: providerLogo,
logo: modelLogo,
helpUrl: providerCfg.Help.URL[entity.LanguageEnglish],
models: eosc.BuildUntyped[string, IModel](),
defaultModels: eosc.BuildUntyped[string, IModel](),
modelsByType: eosc.BuildUntyped[string, []IModel](),
maskKeys: make([]string, 0),
recommend: providerCfg.Recommend,
sort: providerCfg.Sort,
uri: uri,
}
defaultCfg := make(map[string]string)
@@ -126,9 +130,19 @@ type Provider struct {
modelsByType eosc.Untyped[string, []IModel]
maskKeys []string
uri IProviderURI
sort int
recommend bool
IConfig
}
func (p *Provider) Sort() int {
return p.sort
}
func (p *Provider) Recommend() bool {
return p.recommend
}
func (p *Provider) URI() IProviderURI {
return p.uri
}
+4 -4
View File
@@ -319,12 +319,12 @@ func (i *imlInitController) OnInit() {
}
func (i *imlInitController) createAIService(ctx context.Context, teamID string, input *service_dto.CreateService) error {
providerId := "openai"
err := i.providerModule.UpdateProviderConfig(ctx, "openai", &ai_dto.UpdateConfig{
Config: "{\n \"openai_api_base\": \"API Base\",\n \"openai_api_key\": \"API Key\",\n \"openai_organization\": \"Organization\"\n}",
providerId := "fakegpt"
err := i.providerModule.UpdateProviderConfig(ctx, providerId, &ai_dto.UpdateConfig{
Config: "{\n \"apikey\": \"xxx\" \n}",
})
if err != nil {
return fmt.Errorf("update openai config error: %v", err)
return fmt.Errorf("update %s config error: %v", providerId, err)
}
input.Provider = &providerId
if input.Id == "" {
+1 -1
View File
@@ -29,7 +29,7 @@ var (
indexHtml []byte
)
var (
expires = time.Hour * 24 * 7
expires = time.Hour * 24 * 3
cacheControl = fmt.Sprintf("public, max-age=%d", 3600*24*7)
)
@@ -627,10 +627,10 @@
"搜索服务": "K66ea2f0",
"审核中": "K8adf7f8b",
"添加消费者": "K84c4dc71",
"暂无服务描述": "Ka4b45550",
"暂无消费者描述": "Kc3b7bfa8",
"创建并管理自己的消费者实体,每个消费者可以订阅多个API服务,确保在调用之前已获得相应权限。你可以为消费者生成 API 密钥等鉴权方式,用于安全地调用 API 服务": "K5c4e2865",
"订阅的服务数量:已通过 (0) 个,申请中 (1) 个": "K3c7b175f",
"输入名称、ID 查找服务": "K40a89bd8",
"输入名称、ID 查找消费者": "K3a6f905d",
"退出测试": "Kbe3e9335",
"服务市场": "K370a3eb2",
"服务详情": "Kf7ec36d",
@@ -645,6 +645,7 @@
"版本": "K81634069",
"更新时间": "Keefda53d",
"无标签": "K96a2f1c8",
"暂无服务描述": "Ka4b45550",
"API 数量": "K72b0c0b3",
"接入消费者数量": "K70b79760",
"关联标签": "K96059c69",
@@ -654,5 +654,7 @@
"K6e32a344": "Number of Services",
"Ka701316": "Number of Auths",
"K9eaa2eb6": "List",
"Kfaec39e9": "Block"
"Kfaec39e9": "Block",
"Kc3b7bfa8": "No Consumer Description",
"K3a6f905d": "Enter Name, ID to Search Consumer"
}
@@ -672,8 +672,11 @@
"K67b530f": "コンシューマー名",
"K11f34de": "コンシューマー ID",
"Kc01002": "コンシューマーを削除",
"K84c4dc71": "コンシューマーエンティティを作成および管理し、各コンシューマーは複数の API サービスにサブスクライブできます。呼び出し前に適切な権限が付与されていることを確認してください。コンシューマー用に API キーなどの認証方法を生成して、安全に API サービスを呼び出せます。",
"K40a89bd8": "名前または ID を入力してサービスを検索",
"Kba74f26d": "コンシューマーを接続",
"K70b79760": "接続コンシューマー数"
"K70b79760": "接続コンシューマー数",
"K5c4e2865": "コンシューマーエンティティを作成および管理し、各コンシューマーは複数の API サービスにサブスクライブできます。呼び出し前に適切な権限が付与されていることを確認してください。コンシューマー用に API キーなどの認証方法を生成して、安全に API サービスを呼び出せます。",
"K84c4dc71": "コンシューマーを追加",
"Kc3b7bfa8": "コンシューマーの説明がありません",
"K3a6f905d": "名前、IDを入力してコンシューマーを検索"
}
@@ -1 +1,2 @@
{}
{
}
@@ -1,32 +1,2 @@
{
"K7acfcfad": "消费者",
"Kc8054dba": "消费者开发者",
"Keb1673a6": "消费者管理员",
"K1fc2cc28": "无需审核:允许任何消费者调用该服务",
"K8dabb98e": "人工审核:仅允许通过人工审核的消费者调用该服务",
"K7c1fb123": "申请方-消费者",
"K93c2696e": "上线结果",
"K6e32a344": "订阅服务数量",
"Ka701316": "鉴权数量",
"K9eaa2eb6": "列表",
"Kfaec39e9": "块",
"Kdea9a418": "为了安全地调用 API,你需要创建一个消费者以及Token。",
"Keee27105": "团队中包含了人员、消费者和服务,不同团队之间的消费者和服务数据是隔离的,可用于管理企业内部不同的部门/项目组/团队。",
"Kaa717866": "提供服务的团队可以审核来自其他团队的订阅申请,审核通过后的消费者才可发起 API 请求。",
"Kd2c34e2c": "AI 服务",
"K62840d62": "REST 服务",
"K4c72fb6f": "设置团队和成员,然后你可以在团队内创建服务和消费者、订阅API,成员只能看到所属团队内的服务和消费者。",
"K61cca533": "消费者调用统计",
"Kdfff59d4": "请选择消费者",
"K386857bd": "消费者调用量 Top10",
"Kb684c806": "搜索或选择消费者",
"Ke0fbd1c8": "消费者管理",
"K67b530f": "消费者名称",
"K11f34de": "消费者 ID",
"Kc01002": "删除消费者",
"K84c4dc71": "添加消费者",
"K5c4e2865": "创建并管理自己的消费者实体,每个消费者可以订阅多个API服务,确保在调用之前已获得相应权限。你可以为消费者生成 API 密钥等鉴权方式,用于安全地调用 API 服务",
"K40a89bd8": "输入名称、ID 查找服务",
"Kba74f26d": "接入消费者",
"K70b79760": "接入消费者数量"
}
@@ -1,7 +1,4 @@
{
"K93c2696e": "上线结果",
"K6e32a344": "订阅服务数量",
"Ka701316": "鉴权数量",
"K9eaa2eb6": "列表",
"Kfaec39e9": "块"
"Kc3b7bfa8": "暂无消费者描述",
"K3a6f905d": "输入名称、ID 查找消费者"
}
@@ -1,32 +1,4 @@
{
"K7acfcfad": "消费者",
"Kc8054dba": "消费者开发者",
"Keb1673a6": "消费者管理员",
"K1fc2cc28": "无需审核:允许任何消费者调用该服务",
"K8dabb98e": "人工审核:仅允许通过人工审核的消费者调用该服务",
"K7c1fb123": "申请方-消费者",
"K93c2696e": "上线结果",
"K6e32a344": "订阅服务数量",
"Ka701316": "鉴权数量",
"K9eaa2eb6": "列表",
"Kfaec39e9": "块",
"Kdea9a418": "为了安全地调用 API,你需要创建一个消费者以及Token。",
"Keee27105": "团队中包含了人员、消费者和服务,不同团队之间的消费者和服务数据是隔离的,可用于管理企业内部不同的部门/项目组/团队。",
"Kaa717866": "提供服务的团队可以审核来自其他团队的订阅申请,审核通过后的消费者才可发起 API 请求。",
"Kd2c34e2c": "AI 服务",
"K62840d62": "REST 服务",
"K4c72fb6f": "设置团队和成员,然后你可以在团队内创建服务和消费者、订阅API,成员只能看到所属团队内的服务和消费者。",
"K61cca533": "消费者调用统计",
"Kdfff59d4": "请选择消费者",
"K386857bd": "消费者调用量 Top10",
"Kb684c806": "搜索或选择消费者",
"Ke0fbd1c8": "消费者管理",
"K67b530f": "消费者名称",
"K11f34de": "消费者 ID",
"Kc01002": "删除消费者",
"K84c4dc71": "添加消费者",
"K5c4e2865": "创建并管理自己的消费者实体,每个消费者可以订阅多个API服务,确保在调用之前已获得相应权限。你可以为消费者生成 API 密钥等鉴权方式,用于安全地调用 API 服务",
"K40a89bd8": "输入名称、ID 查找服务",
"Kba74f26d": "接入消费者",
"K70b79760": "接入消费者数量"
"Kc3b7bfa8": "暂无消费者描述",
"K3a6f905d": "输入名称、ID 查找消费者"
}
@@ -1,24 +1,3 @@
{
"Kfe93ef35": "Application",
"Kffd7e274": "No Review: All applications are allowed to subscribe to this service",
"K8a8b13e4": "Manual Review: Only reviewed and approved applications can subscribe to this service",
"K9bdd8403": "To securely call APIs, you need to create an application and a token.",
"Kc8239422": "Teams include personnel, applications, and services. Data between different teams is isolated, and can be used to manage different departments/project teams/teams within the enterprise.",
"Ka0a8840a": "Review subscription requests from other applications. Only approved requests can initiate API calls.",
"K5ece3bac": "Set up teams and members. You can then create services and applications, subscribe to APIs within the team. Members can only see services and applications within their team.",
"K1512e983": "Application Call Statistics",
"Kb4d2007f": "Please Select Application",
"Kc0915603": "Application Top 10",
"Kd8a7a689": "Search or Select Application",
"Kb7e869a4": "Application Settings",
"K5168eb63": "Application Name",
"K546e46f": "Application ID",
"K95764d1d": "Delete Application",
"K667bbbe7": "Add Application",
"K8723422e": "Access Application",
"K93d5a66e": "Number of Access Applications",
"K216a1ac7": "Application Developer",
"K27924db": "Application Administrator",
"Kd55c6887": "Review",
"K831aa6c0": "Applicant - Application"
"K40a89bd8": "Enter Name, ID to Search Member"
}
@@ -20,5 +20,6 @@
"K216a1ac7": "アプリケーション開発者",
"K27924db": "アプリケーション管理者",
"Kd55c6887": "レビュー",
"K831aa6c0": "申請元-アプリケーション"
"K831aa6c0": "申請元-アプリケーション",
"K40a89bd8": "名前または ID を入力してサービスを検索"
}
@@ -20,5 +20,6 @@
"K216a1ac7": "消费者开发者",
"K27924db": "消费者管理员",
"Kd55c6887": "审核",
"K831aa6c0": "申请方-消费者"
"K831aa6c0": "申请方-消费者",
"K40a89bd8": "输入名称、ID 查找服务"
}
@@ -20,5 +20,6 @@
"K216a1ac7": "應用程式開發者",
"K27924db": "應用程式管理員",
"Kd55c6887": "審核",
"K831aa6c0": "申請方-應用程式"
"K831aa6c0": "申請方-應用程式",
"K40a89bd8": "輸入名稱、ID 查找服務"
}
@@ -676,5 +676,7 @@
"K5c4e2865": "創建並管理自己的消費者實體,每個消費者可以訂閱多個API服務,確保在調用之前已獲得相應權限。你可以為消費者生成 API 密鑰等鑒權方式,用於安全地調用 API 服務",
"K40a89bd8": "輸入名稱、ID 查找服務",
"Kba74f26d": "接入消費者",
"K70b79760": "接入消費者數量"
"K70b79760": "接入消費者數量",
"Kc3b7bfa8": "暫無消費者描述",
"K3a6f905d": "輸入名稱、ID 查找消費者"
}
@@ -106,10 +106,7 @@ const AiSettingModalContent = forwardRef<AiSettingModalContentHandle,AiSettingMo
label:<div className="flex items-center gap-[10px]">
<span>{x.id}</span>
{x?.scopes?.map(s=><Tag >{s?.toLocaleUpperCase()}</Tag>)}
</div>}))}
onChange={(e)=>{
form.setFieldValue('config',llmList?.find(x=>x.id===e)?.config)
}}>
</div>}))}>
</Select>
</Form.Item>
@@ -196,7 +196,7 @@ useEffect(() => {
item.type === 'addNewItem' ?<WithPermission access="team.application.application.add" showDisabled={false}><Card className="shadow-[0_5px_10px_0_rgba(0,0,0,0.05)] rounded-[10px] overflow-visible cursor-pointer h-[180px] transition duration-500 hover:shadow-[0_5px_20px_0_rgba(0,0,0,0.15)] hover:scale-[1.05]" classNames={{body:'h-[180px] flex items-center justify-center cursor-pointer'}} onClick={()=>{openModal('add')}}>
<div className="flex items-center"><Icon icon="ic:baseline-add" width="18" height="18"/><span>{$t('添加消费者')}</span></div>
</Card></WithPermission> : <Card title={CardTitle(item)} className="shadow-[0_5px_10px_0_rgba(0,0,0,0.05)] rounded-[10px] overflow-visible cursor-pointer h-[180px] transition duration-500 hover:shadow-[0_5px_20px_0_rgba(0,0,0,0.15)] hover:scale-[1.05]" classNames={{header:'border-b-[0px] p-[20px] ', body:"pt-0"}} onClick={()=>{setAppName(item.name);navigateTo(`/consumer/${teamId}/inside/${item.id}/service`)}}>
<span className="line-clamp-3 break-all">{item.description || $t('暂无服务描述')}</span>
<span className="line-clamp-3 break-all">{item.description || $t('暂无消费者描述')}</span>
</Card>}</div>
);
@@ -293,8 +293,8 @@ const TableArea = memo(({language, getServiceList, addNewApp, setTableHttpReload
id="service_hub_list"
columns={[...columns]}
request={()=>getServiceList()}
addNewBtnTitle={$t("添加服务")}
searchPlaceholder={$t("输入名称、ID 查找服务")}
addNewBtnTitle={$t("添加消费者")}
searchPlaceholder={$t("输入名称、ID 查找消费者")}
onAddNewBtnClick={addNewApp}
onChange={() => {
setTableHttpReload(false)
+2 -1
View File
@@ -5,5 +5,6 @@ type UpdateLLM struct {
}
type UpdateConfig struct {
Config string `json:"config"`
DefaultLLM string `json:"default_llm"`
Config string `json:"config"`
}
+3 -1
View File
@@ -7,7 +7,7 @@ type Provider struct {
Name string `json:"name"`
Config string `json:"config"`
GetAPIKeyUrl string `json:"get_apikey_url"`
DefaultLLM string `json:"-"`
DefaultLLM string `json:"defaultLLM"`
DefaultLLMConfig string `json:"-"`
}
@@ -18,6 +18,8 @@ type ProviderItem struct {
DefaultLLMLogo string `json:"default_llm_logo"`
Logo string `json:"logo"`
Configured bool `json:"configured"`
Recommend bool `json:"recommend"`
Sort int `json:"sort"`
UpdateTime time.Time `json:"-"`
}
+28 -11
View File
@@ -90,9 +90,11 @@ func (i *imlProviderModule) Providers(ctx context.Context) ([]*ai_dto.ProviderIt
continue
}
item := &ai_dto.ProviderItem{
Id: v.ID(),
Name: v.Name(),
Logo: v.Logo(),
Id: v.ID(),
Name: v.Name(),
Logo: v.Logo(),
Recommend: v.Recommend(),
Sort: v.Sort(),
}
if info, has := providerMap[v.ID()]; has {
item.Configured = true
@@ -103,8 +105,19 @@ func (i *imlProviderModule) Providers(ctx context.Context) ([]*ai_dto.ProviderIt
items = append(items, item)
}
sort.Slice(items, func(i, j int) bool {
return items[i].UpdateTime.After(items[j].UpdateTime)
if items[i].Configured == items[j].Configured && items[i].Configured {
return items[i].Name < items[j].Name
}
if items[i].Sort != items[j].Sort {
if items[i].Sort == 0 {
return false
}
if items[j].Sort == 0 {
return true
}
return items[i].Sort < items[j].Sort
}
return items[i].Name < items[j].Name
})
return items, nil
}
@@ -134,7 +147,11 @@ func (i *imlProviderModule) Provider(ctx context.Context, id string) (*ai_dto.Pr
}
defaultLLM, has := p.GetModel(info.DefaultLLM)
if !has {
return nil, fmt.Errorf("ai provider llm not found")
model, has := p.DefaultModel(model_runtime.ModelTypeLLM)
if !has {
return nil, fmt.Errorf("ai provider llm not found")
}
defaultLLM = model
}
return &ai_dto.Provider{
Id: info.Id,
@@ -262,14 +279,14 @@ func (i *imlProviderModule) UpdateProviderConfig(ctx context.Context, id string,
if !errors.Is(err, gorm.ErrRecordNotFound) {
return err
}
defaultLLm, ok := p.DefaultModel(model_runtime.ModelTypeLLM)
if !ok {
return fmt.Errorf("ai provider default llm not found")
}
//defaultLLm, ok := p.DefaultModel(model_runtime.ModelTypeLLM)
//if !ok {
// return fmt.Errorf("ai provider default llm not found")
//}
info = &ai.Provider{
Id: id,
Name: p.Name(),
DefaultLLM: defaultLLm.ID(),
DefaultLLM: input.DefaultLLM,
Config: input.Config,
}
}
+1
View File
@@ -24,6 +24,7 @@ type AppItem struct {
Team auto.Label `json:"team" aolabel:"team"`
SubscribeNum int64 `json:"subscribe_num"`
SubscribeVerifyNum int64 `json:"subscribe_verify_num"`
AuthNum int64 `json:"auth_num"`
Description string `json:"description"`
CreateTime auto.TimeLabel `json:"create_time"`
UpdateTime auto.TimeLabel `json:"update_time"`
+18 -5
View File
@@ -7,6 +7,8 @@ import (
"sort"
"strings"
application_authorization "github.com/APIParkLab/APIPark/service/application-authorization"
api_doc "github.com/APIParkLab/APIPark/service/api-doc"
service_tag "github.com/APIParkLab/APIPark/service/service-tag"
@@ -532,11 +534,12 @@ var (
)
type imlAppModule struct {
teamService team.ITeamService `autowired:""`
serviceService service.IServiceService `autowired:""`
teamMemberService team_member.ITeamMemberService `autowired:""`
subscribeService subscribe.ISubscribeService `autowired:""`
transaction store.ITransaction `autowired:""`
teamService team.ITeamService `autowired:""`
serviceService service.IServiceService `autowired:""`
teamMemberService team_member.ITeamMemberService `autowired:""`
subscribeService subscribe.ISubscribeService `autowired:""`
authService application_authorization.IAuthorizationService `autowired:""`
transaction store.ITransaction `autowired:""`
}
func (i *imlAppModule) ExportAll(ctx context.Context) ([]*service_dto.ExportApp, error) {
@@ -600,6 +603,10 @@ func (i *imlAppModule) Search(ctx context.Context, teamId string, keyword string
}
}
authMap, err := i.authService.CountByApp(ctx, serviceIds...)
if err != nil {
return nil, err
}
items := make([]*service_dto.AppItem, 0, len(services))
for _, model := range services {
subscribeNum := subscribeCount[model.Id]
@@ -614,6 +621,7 @@ func (i *imlAppModule) Search(ctx context.Context, teamId string, keyword string
SubscribeNum: subscribeNum,
SubscribeVerifyNum: verifyNum,
CanDelete: subscribeNum == 0,
AuthNum: authMap[model.Id],
})
}
sort.Slice(items, func(i, j int) bool {
@@ -720,6 +728,10 @@ func (i *imlAppModule) SearchMyApps(ctx context.Context, teamId string, keyword
if err != nil {
return nil, err
}
authMap, err := i.authService.CountByApp(ctx, serviceIds...)
if err != nil {
return nil, err
}
subscribeCount := map[string]int64{}
subscribeVerifyCount := map[string]int64{}
@@ -756,6 +768,7 @@ func (i *imlAppModule) SearchMyApps(ctx context.Context, teamId string, keyword
SubscribeNum: subscribeNum,
SubscribeVerifyNum: verifyNum,
CanDelete: subscribeNum == 0,
AuthNum: authMap[model.Id],
})
}
sort.Slice(items, func(i, j int) bool {
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh
# ===========================================================================
# File: build.sh
# Description: usage: ./prefix.sh
# ===========================================================================
cd "$(dirname "$0")"
cd ../../
BASEPATH="$(pwd)"
set -e
# =========================================================================
# 更新 aoaccount
# =========================================================================
echo "更新 eosc"
cd "${BASEPATH}/"
if [ ! -d "./eosc" ]; then
git clone http://gitlab.eolink.com/goku/eosc.git
fi
cd "./eosc" && git pull
# =========================================================================
# 更新 aoaccount
# =========================================================================
echo "更新 aoaccount"
cd "${BASEPATH}/"
if [ ! -d "./aoaccount" ]; then
git clone http://gitlab.eolink.com/apinto/aoaccount.git
fi
cd "./aoaccount" && git pull
+14 -6
View File
@@ -3,11 +3,11 @@ package application_authorization
import (
"context"
"time"
"github.com/eolinker/go-common/utils"
"github.com/eolinker/go-common/auto"
"github.com/APIParkLab/APIPark/service/universally"
"github.com/APIParkLab/APIPark/stores/service"
)
@@ -24,6 +24,14 @@ type imlAuthorizationService struct {
universally.IServiceEdit[Edit]
}
func (i *imlAuthorizationService) CountByApp(ctx context.Context, appId ...string) (map[string]int64, error) {
w := map[string]interface{}{}
if len(appId) > 0 {
w["application"] = appId
}
return i.store.CountByGroup(ctx, "", w, "application")
}
func (i *imlAuthorizationService) ListByApp(ctx context.Context, appId ...string) ([]*Authorization, error) {
w := map[string]interface{}{}
if len(appId) > 0 {
@@ -51,11 +59,11 @@ func (i *imlAuthorizationService) GetLabels(ctx context.Context, ids ...string)
func (i *imlAuthorizationService) OnComplete() {
i.IServiceGet = universally.NewGet[Authorization, service.Authorization](i.store, FromEntity)
i.IServiceDelete = universally.NewDelete[service.Authorization](i.store)
i.IServiceCreate = universally.NewCreator[Create, service.Authorization](i.store, "project_authorization", createEntityHandler, uniquestHandler, labelHandler)
i.IServiceEdit = universally.NewEdit[Edit, service.Authorization](i.store, updateHandler, labelHandler)
auto.RegisterService("project_authorization", i)
}
+2 -1
View File
@@ -3,7 +3,7 @@ package application_authorization
import (
"context"
"reflect"
"github.com/APIParkLab/APIPark/service/universally"
"github.com/eolinker/go-common/autowire"
)
@@ -14,6 +14,7 @@ type IAuthorizationService interface {
universally.IServiceCreate[Create]
universally.IServiceEdit[Edit]
ListByApp(ctx context.Context, appId ...string) ([]*Authorization, error)
CountByApp(ctx context.Context, appId ...string) (map[string]int64, error)
}
func init() {
+5 -5
View File
@@ -13,9 +13,9 @@ type API struct {
Creator string `gorm:"size:36;not null;column:creator;comment:创建人;index:creator" aovalue:"creator"` // 创建人
CreateAt time.Time `gorm:"type:timestamp;NOT NULL;DEFAULT:CURRENT_TIMESTAMP;column:create_at;comment:创建时间"`
IsDelete int `gorm:"type:tinyint(1);not null;column:is_delete;comment:是否删除 0:未删除 1:已删除"`
Method []string `gorm:"size:36;not null;column:method;comment:请求方法;serializer:json"`
Method []string `gorm:"size:255;not null;column:method;comment:请求方法;serializer:json"`
Protocol []string `gorm:"type:text;not null;column:protocol;comment:协议;serializer:json"`
Path string `gorm:"size:512;not null;column:path;comment:请求路径"`
Path string `gorm:"size:255;not null;column:path;comment:请求路径"`
}
type Info struct {
Id int64 `gorm:"column:id;type:BIGINT(20);NOT NULL;comment:id;primary_key;comment:主键ID;"`
@@ -25,8 +25,8 @@ type Info struct {
Service string `gorm:"size:36;not null;column:service;comment:服务;index:service"`
Team string `gorm:"size:36;not null;column:team;comment:团队;index:team"` // 团队id
Upstream string `gorm:"size:36;not null;column:upstream;comment:上游;index:upstream"`
Method []string `gorm:"size:36;not null;column:method;comment:请求方法;serializer:json" `
Path string `gorm:"size:512;not null;column:path;comment:请求路径"`
Method []string `gorm:"size:255;not null;column:method;comment:请求方法;serializer:json" `
Path string `gorm:"size:255;not null;column:path;comment:请求路径"`
Protocol []string `gorm:"type:text;null;column:protocol;comment:协议;serializer:json"`
Match string `gorm:"type:text;null;column:match;comment:匹配规则"`
Creator string `gorm:"size:36;not null;column:creator;comment:创建人;index:creator" aovalue:"creator"` // 创建人
@@ -74,7 +74,7 @@ type AiAPIInfo struct {
Uuid string `gorm:"type:varchar(36);not null;column:uuid;uniqueIndex:uuid;comment:UUID"`
Name string `gorm:"type:varchar(100);not null;column:name;comment:name"`
Service string `gorm:"size:36;not null;column:service;comment:服务;index:service"`
Path string `gorm:"size:512;not null;column:path;comment:请求路径"`
Path string `gorm:"size:255;not null;column:path;comment:请求路径"`
Description string `gorm:"size:255;not null;column:description;comment:description"`
Timeout int `gorm:"type:int(11);not null;column:timeout;comment:超时时间"`
Retry int `gorm:"type:int(11);not null;column:retry;comment:重试次数"`