Compare commits

...

27 Commits

Author SHA1 Message Date
Liujian 8d44d796b4 update workflows actions/download-artifact to v4 2025-02-08 16:14:01 +08:00
Liujian fd6680d615 update workflows actions/upload-artifact to v4 2025-02-08 15:57:36 +08:00
Liujian 945d53fcfd Merge remote-tracking branch 'github-pro/main' into feature/openapi 2025-02-08 15:01:27 +08:00
Liujian ac7045b724 Fix: AI provider's default key synchronization to Apinto failed issue 2025-02-08 14:58:36 +08:00
Liujian c907bdc4a5 Merge remote-tracking branch 'origin/main' into feature/openapi 2025-01-23 16:54:58 +08:00
ningyv 733ed9ac2f Merge pull request #183 from APIParkLab/feature/1.4
chroe: optimize AI model node graphics
2025-01-23 14:01:10 +08:00
ningyv 1d8e579a10 Merge remote-tracking branch 'origin/main' into feature/1.4 2025-01-23 13:57:01 +08:00
lichunxian 567cac9c95 Merge branch 'feature/1.4' into 'main'
chroe: optimize AI model node graphics

See merge request apipark/APIPark!161
2025-01-21 11:52:02 +08:00
ningyv 095c09c8c0 chroe: optimize AI model node graphics 2025-01-21 11:50:58 +08:00
刘健 e9c949822d Merge branch 'feature/openapi' into 'main'
Feature/openapi

See merge request apipark/APIPark!160
2025-01-20 17:36:53 +08:00
刘健 f7801261c3 Merge branch 'feature/openapi' into 'main'
fix: Nsq returns no error directly after parsing JSON exceptionNsq returns no...

See merge request apipark/APIPark!159
2025-01-17 16:03:51 +08:00
刘健 b0c37918b5 Merge branch 'feature/merge' into 'main'
fix: login page redirect multiple times (#166)

See merge request apipark/APIPark!158
2025-01-16 14:57:39 +08:00
刘健 d5af1c8da3 Merge branch 'feature/ai-balance' into 'main'
Feature/1.4 (#154)

See merge request apipark/APIPark!157
2025-01-15 16:04:24 +08:00
秦圆圆 7c827804f4 Merge branch 'feature/1.4' into 'main'
fix: In the supplier load chart, the mouse should not show a hand shape except...

See merge request apipark/APIPark!156
2025-01-07 18:41:58 +08:00
scarqin b0dacbda0d fix: When the current supplier is abnormal, there should be a line on the model pointing to the next model, which means that the APIs on this link are associated with the next valid supplier. 2025-01-07 18:40:43 +08:00
scarqin d5abde2593 fix: The language option is wrong. The current language is Chinese, but the option is displayed as English. 2025-01-07 18:14:25 +08:00
scarqin bc3290de3b fix: jump link error 2025-01-07 17:56:16 +08:00
scarqin 7f438bf776 fix: When the current supplier is abnormal, there should be a line on the model pointing to the next model, which means that the APIs on this link are associated with the next valid supplier. 2025-01-07 17:54:53 +08:00
scarqin 13cfe24b2f fix: error line 2025-01-07 17:21:21 +08:00
刘健 f5cfd77550 Merge branch 'feature/ai-balance' into 'main'
fix: ai provider status error

See merge request apipark/APIPark!155
2025-01-07 16:50:27 +08:00
刘健 4a8f5152b3 Merge branch 'feature/ai-balance' into 'main'
AI API token quantity docking completed

See merge request apipark/APIPark!154
2025-01-07 12:49:51 +08:00
秦圆圆 83ac747cb1 Merge branch 'feature/1.4' into 'main'
fix: After the release log configuration is successful, there is no success...

See merge request apipark/APIPark!153
2025-01-07 11:33:54 +08:00
刘健 d5eedd1dd2 Merge branch 'feature/ai-balance' into 'main'
fix: ai key config error

See merge request apipark/APIPark!152
2025-01-07 09:23:34 +08:00
秦圆圆 86758383c4 Merge branch 'feature/1.4' into 'main'
Feature/1.4

See merge request apipark/APIPark!151
2025-01-06 19:45:37 +08:00
刘健 6ce3e0bfac Merge branch 'feature/ai-balance' into 'main'
update ai key status to gateway

See merge request apipark/APIPark!150
2025-01-06 10:57:54 +08:00
刘健 e4eadf863e Merge branch 'feature/ai-balance' into 'main'
fix: ai key sort

See merge request apipark/APIPark!149
2025-01-06 10:26:39 +08:00
刘健 ca328e784c Merge branch 'feature/ai-balance' into 'main'
Feature/ai balance

See merge request apipark/APIPark!148
2025-01-06 10:02:19 +08:00
6 changed files with 62 additions and 60 deletions
+3 -3
View File
@@ -25,7 +25,7 @@ jobs:
echo "Build frontend..." echo "Build frontend..."
cd ./frontend && pnpm run build cd ./frontend && pnpm run build
- name: upload frontend release - name: upload frontend release
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: frontend-package name: frontend-package
path: frontend/dist path: frontend/dist
@@ -41,7 +41,7 @@ jobs:
- name: Checkout #Checkout代码 - name: Checkout #Checkout代码
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: download frontend release - name: download frontend release
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: frontend-package name: frontend-package
path: frontend/dist path: frontend/dist
@@ -71,7 +71,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: download frontend release - name: download frontend release
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: frontend-package name: frontend-package
path: frontend/dist path: frontend/dist
@@ -27,6 +27,7 @@ export const KeyStatusNode: React.FC<{ data: KeyStatusNodeData }> = ({ data }) =
<div <div
className="flex gap-1 w-full" className="flex gap-1 w-full"
style={{ style={{
minWidth: keys.length > 5 ? '118px' : 'auto',
maxWidth: `calc(${MAX_KEYS} * ${KEY_SIZE} + (${MAX_KEYS} - 1) * ${KEY_GAP})`, maxWidth: `calc(${MAX_KEYS} * ${KEY_SIZE} + (${MAX_KEYS} - 1) * ${KEY_GAP})`,
minHeight: KEY_SIZE minHeight: KEY_SIZE
}} }}
@@ -29,46 +29,48 @@ export const ModelCardNode: React.FC<{ data: ModelCardNodeData }> = ({ data }) =
const statusConfig = getStatusIcon(status) const statusConfig = getStatusIcon(status)
return ( return (
<div <>
className="node-card bg-white rounded-lg shadow-sm p-4 min-w-[280px] group" <div
style={{ border: '1px solid var(--border-color)' }} className="node-card bg-white rounded-lg shadow-sm p-4 min-w-[280px] group"
> style={{ border: '1px solid var(--border-color)' }}
<Handle type="target" position={Position.Left} /> >
<Handle type="source" position={Position.Right} /> <Handle type="target" position={Position.Left} />
<div> <Handle type="source" position={Position.Right} />
<div className="flex justify-between items-center"> <div>
<div className="flex gap-2 items-center"> <div className="flex justify-between items-center">
<div className="flex flex-1 overflow-hidden items-center gap-[4px]"> <div className="flex gap-2 items-center">
<span <div className="flex flex-1 overflow-hidden items-center gap-[4px]">
className="flex items-center h-[22px] ai-setting-svg-container" <span
dangerouslySetInnerHTML={{ __html: logo }} className="flex items-center h-[22px] ai-setting-svg-container"
></span> dangerouslySetInnerHTML={{ __html: logo }}
></span>
</div>
<span className="text-base text-gray-900 max-w-[180px] truncate">{name}</span>
<Icon icon={statusConfig?.icon} className={`text-xl ${statusConfig?.color}`} />
</div> </div>
<span className="text-base text-gray-900 max-w-[180px] truncate">{name}</span>
<Icon icon={statusConfig?.icon} className={`text-xl ${statusConfig?.color}`} />
</div>
{/* Action buttons */} {/* Action buttons */}
<div className="flex gap-2 transition-opacity duration-200"> <div className="flex gap-2 transition-opacity duration-200">
<Icon <Icon
icon="mdi:cog" icon="mdi:cog"
className="text-xl text-gray-400 cursor-pointer hover:text-[--primary-color]" className="text-xl text-gray-400 cursor-pointer hover:text-[--primary-color]"
onClick={() => { onClick={() => {
openConfigModal({ id: data.id, defaultLlm: defaultLlm } as AiSettingListItem) openConfigModal({ id: data.id, defaultLlm: defaultLlm } as AiSettingListItem)
}} }}
/> />
</div>
</div>
<div className="mt-2 text-sm text-gray-500">
{$t('默认:')}
{defaultLlm}
</div> </div>
</div> </div>
<div className="mt-2 text-sm text-gray-500">
{$t('默认:')}
{defaultLlm}
</div>
{status !== 'enabled' && alternativeModel && (
<div className="mt-1 text-sm text-gray-500">
{$t('关联 API 已转用')} {alternativeModel.name}/{alternativeModel.defaultLlm}
</div>
)}
</div> </div>
</div> {status !== 'enabled' && alternativeModel && (
<div className="ml-4 mt-1 text-sm text-gray-500">
{$t('关联 API 已转用')} {alternativeModel.name}/{alternativeModel.defaultLlm}
</div>
)}
</>
) )
} }
@@ -18,11 +18,15 @@
.react-flow__node { .react-flow__node {
padding: 0; padding: 0;
border-radius: 8px; border-radius: 8px;
min-width: 150px;
width: auto; width: auto;
max-width: 100%; max-width: 100%;
} }
.react-flow__node-modelCard,
.react-flow__node-serviceCard {
min-width: 150px;
}
/* Custom Node Styles */ /* Custom Node Styles */
.custom-node { .custom-node {
background: white; background: white;
+11 -18
View File
@@ -535,15 +535,15 @@ func (i *imlProviderModule) UpdateProviderConfig(ctx context.Context, id string,
Priority: input.Priority, Priority: input.Priority,
Status: &status, Status: &status,
} }
_, err = i.aiKeyService.DefaultKey(ctx, id) _, err = i.aiKeyService.DefaultKey(txCtx, id)
if err != nil { if err != nil {
if !errors.Is(err, gorm.ErrRecordNotFound) { if !errors.Is(err, gorm.ErrRecordNotFound) {
return err return err
} }
err = i.aiKeyService.Create(ctx, &ai_key.Create{ err = i.aiKeyService.Create(txCtx, &ai_key.Create{
ID: id, ID: id,
Name: info.Name, Name: info.Name,
Config: info.Config, Config: input.Config,
Provider: id, Provider: id,
Status: 1, Status: 1,
ExpireTime: 0, ExpireTime: 0,
@@ -551,28 +551,21 @@ func (i *imlProviderModule) UpdateProviderConfig(ctx context.Context, id string,
Priority: 1, Priority: 1,
}) })
} else { } else {
err = i.aiKeyService.Save(ctx, id, &ai_key.Edit{ err = i.aiKeyService.Save(txCtx, id, &ai_key.Edit{
Config: &info.Config, Config: &input.Config,
Status: &status,
}) })
} }
if err != nil { if err != nil {
return err return err
} }
err = i.providerService.Save(txCtx, id, pInfo)
//if input.Enable != nil {
// status = 0
// if *input.Enable {
// status = 1
// }
// pInfo.Status = &status
//}
err = i.providerService.Save(ctx, id, pInfo)
if err != nil { if err != nil {
return err return err
} }
if *pInfo.Status == 0 { if *pInfo.Status == 0 {
return i.syncGateway(ctx, cluster.DefaultClusterID, []*gateway.DynamicRelease{ return i.syncGateway(txCtx, cluster.DefaultClusterID, []*gateway.DynamicRelease{
{ {
BasicItem: &gateway.BasicItem{ BasicItem: &gateway.BasicItem{
ID: id, ID: id,
@@ -581,8 +574,8 @@ func (i *imlProviderModule) UpdateProviderConfig(ctx context.Context, id string,
}, },
}, false) }, false)
} }
// 获取当前供应商所有Key信息 // 获取当前供应商默认Key信息
defaultKey, err := i.aiKeyService.DefaultKey(ctx, id) defaultKey, err := i.aiKeyService.DefaultKey(txCtx, id)
if err != nil { if err != nil {
return err return err
} }
@@ -592,7 +585,7 @@ func (i *imlProviderModule) UpdateProviderConfig(ctx context.Context, id string,
cfg["model_config"] = model.DefaultConfig() cfg["model_config"] = model.DefaultConfig()
cfg["priority"] = info.Priority cfg["priority"] = info.Priority
cfg["base"] = fmt.Sprintf("%s://%s", p.URI().Scheme(), p.URI().Host()) cfg["base"] = fmt.Sprintf("%s://%s", p.URI().Scheme(), p.URI().Host())
return i.syncGateway(ctx, cluster.DefaultClusterID, []*gateway.DynamicRelease{ return i.syncGateway(txCtx, cluster.DefaultClusterID, []*gateway.DynamicRelease{
{ {
BasicItem: &gateway.BasicItem{ BasicItem: &gateway.BasicItem{
ID: id, ID: id,
+4 -2
View File
@@ -100,7 +100,8 @@ func (i *imlAuthorizationModule) getApplications(ctx context.Context, appIds []s
Config: authCfg, Config: authCfg,
HideCredential: a.HideCredential, HideCredential: a.HideCredential,
Label: map[string]string{ Label: map[string]string{
"authorization": a.UUID, "authorization": a.UUID,
"authorization_name": a.Name,
}, },
} }
}), }),
@@ -157,7 +158,8 @@ func (i *imlAuthorizationModule) online(ctx context.Context, s *service.Service)
Config: authCfg, Config: authCfg,
HideCredential: a.HideCredential, HideCredential: a.HideCredential,
Label: map[string]string{ Label: map[string]string{
"authorization": a.UUID, "authorization": a.UUID,
"authorization_name": a.Name,
}, },
} }
}), }),