mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c69a1bcb5d | |||
| b8512841b8 | |||
| 2c2227701d | |||
| 5b1f6b4670 | |||
| 197d227cd6 | |||
| b77ce23b39 |
@@ -210,7 +210,7 @@ APIPark uses the Apache 2.0 License. For more details, please refer to the LICEN
|
|||||||
For enterprise-level features and professional technical support, contact our pre-sales experts for personalized demos, customized solutions, and pricing.
|
For enterprise-level features and professional technical support, contact our pre-sales experts for personalized demos, customized solutions, and pricing.
|
||||||
|
|
||||||
- Website: https://apipark.com
|
- Website: https://apipark.com
|
||||||
- Email: contact@apipark.com
|
- Email: dev@apipark.com
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
+11
-17
@@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -28,8 +27,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NSQConfig struct {
|
type NSQConfig struct {
|
||||||
Addr string `json:"addr" yaml:"addr"`
|
Addr string `json:"addr"`
|
||||||
TopicPrefix string `json:"topic_prefix" yaml:"topic_prefix"`
|
TopicPrefix string `json:"topic_prefix"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义 NSQ 消息结构
|
// 定义 NSQ 消息结构
|
||||||
@@ -79,11 +78,6 @@ 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))
|
|
||||||
}
|
|
||||||
|
|
||||||
// HandleMessage 处理从 NSQ 读取的消息
|
// HandleMessage 处理从 NSQ 读取的消息
|
||||||
func (h *NSQHandler) HandleMessage(message *nsq.Message) error {
|
func (h *NSQHandler) HandleMessage(message *nsq.Message) error {
|
||||||
log.Printf("Received message: %s", string(message.Body))
|
log.Printf("Received message: %s", string(message.Body))
|
||||||
@@ -93,14 +87,14 @@ func (h *NSQHandler) HandleMessage(message *nsq.Message) error {
|
|||||||
err := json.Unmarshal(message.Body, &data)
|
err := json.Unmarshal(message.Body, &data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to unmarshal message: %v", err)
|
log.Printf("Failed to unmarshal message: %v", err)
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将时间字符串转换为 time.Time
|
// 将时间字符串转换为 time.Time
|
||||||
timestamp, err := time.Parse(time.RFC3339, data.TimeISO8601)
|
timestamp, err := time.Parse(time.RFC3339, data.TimeISO8601)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to parse timestamp: %v", err)
|
log.Printf("Failed to parse timestamp: %v", err)
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
day := time.Date(timestamp.Year(), timestamp.Month(), timestamp.Day(), 0, 0, 0, 0, timestamp.Location())
|
day := time.Date(timestamp.Year(), timestamp.Month(), timestamp.Day(), 0, 0, 0, 0, timestamp.Location())
|
||||||
@@ -110,13 +104,14 @@ func (h *NSQHandler) HandleMessage(message *nsq.Message) error {
|
|||||||
finalStatus := &AIProviderStatus{}
|
finalStatus := &AIProviderStatus{}
|
||||||
for _, s := range data.AI.ProviderStats {
|
for _, s := range data.AI.ProviderStats {
|
||||||
status := ToKeyStatus(s.Status).Int()
|
status := ToKeyStatus(s.Status).Int()
|
||||||
key := genAIKey(s.Key, s.Provider)
|
keys := strings.Split(s.Key, "@")
|
||||||
|
key := keys[0]
|
||||||
err = h.aiKeyService.Save(ctx, key, &ai_key.Edit{
|
err = h.aiKeyService.Save(ctx, key, &ai_key.Edit{
|
||||||
Status: &status,
|
Status: &status,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to save AI key: %v", err)
|
log.Printf("Failed to save AI key: %v", err)
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
if s.Provider != data.AI.Provider {
|
if s.Provider != data.AI.Provider {
|
||||||
|
|
||||||
@@ -133,12 +128,11 @@ func (h *NSQHandler) HandleMessage(message *nsq.Message) error {
|
|||||||
finalStatus = &s
|
finalStatus = &s
|
||||||
}
|
}
|
||||||
if finalStatus != nil {
|
if finalStatus != nil {
|
||||||
//keys := strings.Split(finalStatus.Key, "@")
|
keys := strings.Split(finalStatus.Key, "@")
|
||||||
key := genAIKey(finalStatus.Key, finalStatus.Provider)
|
err = h.aiKeyService.IncrUseToken(ctx, keys[0], convertInt(data.AI.TotalToken))
|
||||||
err = h.aiKeyService.IncrUseToken(ctx, key, convertInt(data.AI.TotalToken))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to increment AI key token: %v", err)
|
log.Printf("Failed to increment AI key token: %v", err)
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +151,7 @@ func (h *NSQHandler) HandleMessage(message *nsq.Message) error {
|
|||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to call AI API: %v", err)
|
log.Printf("Failed to call AI API: %v", err)
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Message processed and saved to MySQL: %+v", data)
|
log.Printf("Message processed and saved to MySQL: %+v", data)
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ const LanguageSetting = ({ mode = 'light' }: { mode?: 'dark' | 'light' }) => {
|
|||||||
i18n.changeLanguage(supportedLang)
|
i18n.changeLanguage(supportedLang)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
trigger={['hover']}
|
trigger={['hover']}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ 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,53 +29,46 @@ export const ModelCardNode: React.FC<{ data: ModelCardNodeData }> = ({ data }) =
|
|||||||
const statusConfig = getStatusIcon(status)
|
const statusConfig = getStatusIcon(status)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div
|
||||||
<div
|
className="node-card bg-white rounded-lg shadow-sm p-4 min-w-[280px] group"
|
||||||
className="node-card bg-white rounded-lg shadow-sm p-4 min-w-[280px] group"
|
style={{ border: '1px solid var(--border-color)' }}
|
||||||
style={{ border: '1px solid var(--border-color)' }}
|
>
|
||||||
>
|
<Handle type="target" position={Position.Left} />
|
||||||
<Handle type="target" position={Position.Left} />
|
<Handle type="source" position={Position.Right} />
|
||||||
<Handle type="source" position={Position.Right} />
|
<div>
|
||||||
<div>
|
<div className="flex justify-between items-center">
|
||||||
<div className="flex justify-between items-center">
|
<div className="flex gap-2 items-center">
|
||||||
<div className="flex gap-2 items-center">
|
<div className="flex flex-1 overflow-hidden items-center gap-[4px]">
|
||||||
<div className="flex flex-1 overflow-hidden items-center gap-[4px]">
|
<span
|
||||||
<span
|
className="flex items-center h-[22px] ai-setting-svg-container"
|
||||||
className="flex items-center h-[22px] ai-setting-svg-container"
|
dangerouslySetInnerHTML={{ __html: logo }}
|
||||||
dangerouslySetInnerHTML={{ __html: logo }}
|
></span>
|
||||||
></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 && (
|
{status !== 'enabled' && alternativeModel && (
|
||||||
<div className="mt-1 text-sm text-gray-500">
|
<div className="mt-1 text-sm text-gray-500">
|
||||||
{$t('关联 API 已转用')} {alternativeModel.name}/{alternativeModel.defaultLlm}
|
{$t('关联 API 已转用')} {alternativeModel.name}/{alternativeModel.defaultLlm}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{status !== 'enabled' && alternativeModel && (
|
</div>
|
||||||
<div className="ml-4 mt-1 text-sm text-gray-500">
|
|
||||||
{$t('关联 API 已转用')} {alternativeModel.name}/{alternativeModel.defaultLlm}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,15 +18,11 @@
|
|||||||
.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;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
b: "subscription_service:#{application}"
|
b: "subscription_service:#{application}"
|
||||||
response:
|
response:
|
||||||
status_code: 403
|
status_code: 403
|
||||||
content_type: "text/plan"
|
content_typ: "text/plan"
|
||||||
charset: "utf-8"
|
charset: "utf-8"
|
||||||
body: "Forbidden"
|
body: "Forbidden"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
_ "github.com/APIParkLab/APIPark/frontend"
|
_ "github.com/APIParkLab/APIPark/frontend"
|
||||||
_ "github.com/APIParkLab/APIPark/gateway/apinto"
|
_ "github.com/APIParkLab/APIPark/gateway/apinto"
|
||||||
_ "github.com/APIParkLab/APIPark/plugins/core"
|
_ "github.com/APIParkLab/APIPark/plugins/core"
|
||||||
_ "github.com/APIParkLab/APIPark/plugins/openapi"
|
|
||||||
_ "github.com/APIParkLab/APIPark/plugins/permit"
|
_ "github.com/APIParkLab/APIPark/plugins/permit"
|
||||||
_ "github.com/APIParkLab/APIPark/plugins/publish_flow"
|
_ "github.com/APIParkLab/APIPark/plugins/publish_flow"
|
||||||
_ "github.com/APIParkLab/APIPark/resources/locale"
|
_ "github.com/APIParkLab/APIPark/resources/locale"
|
||||||
|
|||||||
+7
-9
@@ -533,7 +533,6 @@ func (i *imlProviderModule) UpdateProviderConfig(ctx context.Context, id string,
|
|||||||
DefaultLLM: &input.DefaultLLM,
|
DefaultLLM: &input.DefaultLLM,
|
||||||
Config: &input.Config,
|
Config: &input.Config,
|
||||||
Priority: input.Priority,
|
Priority: input.Priority,
|
||||||
Status: &status,
|
|
||||||
}
|
}
|
||||||
_, err = i.aiKeyService.DefaultKey(ctx, id)
|
_, err = i.aiKeyService.DefaultKey(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -559,18 +558,17 @@ func (i *imlProviderModule) UpdateProviderConfig(ctx context.Context, id string,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
//if input.Enable != nil {
|
if input.Enable != nil {
|
||||||
// status = 0
|
status = 0
|
||||||
// if *input.Enable {
|
if *input.Enable {
|
||||||
// status = 1
|
status = 1
|
||||||
// }
|
}
|
||||||
// pInfo.Status = &status
|
pInfo.Status = &status
|
||||||
//}
|
}
|
||||||
err = i.providerService.Save(ctx, id, pInfo)
|
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(ctx, cluster.DefaultClusterID, []*gateway.DynamicRelease{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package openapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/eolinker/go-common/pm3"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (p *plugin) appAuthorizationApis() []pm3.Api {
|
|
||||||
return []pm3.Api{
|
|
||||||
pm3.CreateApiWidthDoc(http.MethodPost, "/openapi/v1/app/authorization", []string{"context", "query:app", "body"}, []string{"authorization"}, p.authorizationController.AddAuthorization),
|
|
||||||
pm3.CreateApiWidthDoc(http.MethodPut, "/openapi/v1/app/authorization", []string{"context", "query:app", "query:authorization", "body"}, []string{"authorization"}, p.authorizationController.EditAuthorization),
|
|
||||||
pm3.CreateApiWidthDoc(http.MethodDelete, "/openapi/v1/app/authorization", []string{"context", "query:app", "query:authorization"}, nil, p.authorizationController.DeleteAuthorization),
|
|
||||||
pm3.CreateApiWidthDoc(http.MethodGet, "/openapi/v1/app/authorization", []string{"context", "query:app", "query:authorization"}, []string{"authorization"}, p.authorizationController.Info),
|
|
||||||
pm3.CreateApiWidthDoc(http.MethodGet, "/openapi/v1/app/authorizations", []string{"context", "query:app"}, []string{"authorizations"}, p.authorizationController.Authorizations),
|
|
||||||
pm3.CreateApiWidthDoc(http.MethodGet, "/openapi/v1/app/authorization/details", []string{"context", "query:app", "query:authorization"}, []string{"details"}, p.authorizationController.Detail),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package openapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/eolinker/eosc/env"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
defaultAPIKey = "37eb0ebf"
|
|
||||||
openCheck = newOpenapiCheck()
|
|
||||||
)
|
|
||||||
|
|
||||||
type openapiCheck struct {
|
|
||||||
apikey string
|
|
||||||
}
|
|
||||||
|
|
||||||
func newOpenapiCheck() *openapiCheck {
|
|
||||||
apikey, has := env.GetEnv("API_KEY")
|
|
||||||
if !has {
|
|
||||||
apikey = defaultAPIKey
|
|
||||||
}
|
|
||||||
return &openapiCheck{apikey: apikey}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *openapiCheck) Check(method string, path string) (bool, []gin.HandlerFunc) {
|
|
||||||
if strings.HasPrefix(path, "/openapi/") {
|
|
||||||
return true, []gin.HandlerFunc{o.Handler}
|
|
||||||
}
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *openapiCheck) Sort() int {
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *openapiCheck) Handler(ginCtx *gin.Context) {
|
|
||||||
authorization := ginCtx.GetHeader("Authorization")
|
|
||||||
if authorization == "" {
|
|
||||||
ginCtx.AbortWithStatusJSON(403, gin.H{"code": -8, "msg": "invalid token", "success": "fail"})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package openapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/eolinker/go-common/autowire"
|
|
||||||
"github.com/eolinker/go-common/pm3"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
pm3.Register("openapi", new(Driver))
|
|
||||||
}
|
|
||||||
|
|
||||||
type Driver struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Driver) Create() (pm3.IPlugin, error) {
|
|
||||||
p := new(plugin)
|
|
||||||
autowire.Autowired(p)
|
|
||||||
return p, nil
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package openapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
application_authorization "github.com/APIParkLab/APIPark/controller/application-authorization"
|
|
||||||
"github.com/eolinker/go-common/pm3"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
_ pm3.IPlugin = (*plugin)(nil)
|
|
||||||
_ pm3.IPluginMiddleware = (*plugin)(nil)
|
|
||||||
)
|
|
||||||
|
|
||||||
type plugin struct {
|
|
||||||
apis []pm3.Api
|
|
||||||
authorizationController application_authorization.IAuthorizationController `autowired:""`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *plugin) Middlewares() []pm3.IMiddleware {
|
|
||||||
return []pm3.IMiddleware{
|
|
||||||
openCheck,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *plugin) APis() []pm3.Api {
|
|
||||||
return p.apis
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *plugin) Name() string {
|
|
||||||
return "openapi"
|
|
||||||
}
|
|
||||||
func (p *plugin) OnComplete() {
|
|
||||||
p.apis = p.appAuthorizationApis()
|
|
||||||
}
|
|
||||||
+1
-1
@@ -211,7 +211,7 @@ APIParkはApache 2.0ライセンスの下で提供されています。詳細に
|
|||||||
エンタープライズ機能や専門的な技術サポートについては、プリセールスの専門家に連絡し、個別デモ、カスタムソリューション、価格情報を入手してください。
|
エンタープライズ機能や専門的な技術サポートについては、プリセールスの専門家に連絡し、個別デモ、カスタムソリューション、価格情報を入手してください。
|
||||||
|
|
||||||
- ウェブサイト: https://apipark.com
|
- ウェブサイト: https://apipark.com
|
||||||
- メール: contact@apipark.com
|
- メール: dev@apipark.com
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ APIPark 使用 Apache 2.0 许可证。更多详情请查看 LICENSE 文件。
|
|||||||
对于企业级功能和专业技术支持,请联系售前专家进行个性化演示、定制方案和获取报价。
|
对于企业级功能和专业技术支持,请联系售前专家进行个性化演示、定制方案和获取报价。
|
||||||
|
|
||||||
- 网站: https://apipark.com
|
- 网站: https://apipark.com
|
||||||
- 电子邮件: contact@apipark.com
|
- 电子邮件: dev@apipark.com
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ APIPark 使用 Apache 2.0 授權條款。更多詳情請參閱 LICENSE 文件。
|
|||||||
如需企業級功能與專業技術支援,請聯絡我們的售前專家,獲取個性化演示、定制方案和報價。
|
如需企業級功能與專業技術支援,請聯絡我們的售前專家,獲取個性化演示、定制方案和報價。
|
||||||
|
|
||||||
- 網站: https://apipark.com
|
- 網站: https://apipark.com
|
||||||
- 電子郵件: contact@apipark.com
|
- 電子郵件: dev@apipark.com
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
version: v8
|
version: v7
|
||||||
sort:
|
sort:
|
||||||
- "access_log"
|
- "access_log"
|
||||||
- "monitor"
|
- "monitor"
|
||||||
@@ -41,7 +41,7 @@ plugin:
|
|||||||
b: "subscription_service:#{application}"
|
b: "subscription_service:#{application}"
|
||||||
response:
|
response:
|
||||||
status_code: 403
|
status_code: 403
|
||||||
content_type: "text/plan"
|
content_typ: "text/plan"
|
||||||
charset: "utf-8"
|
charset: "utf-8"
|
||||||
body: "Forbidden"
|
body: "Forbidden"
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -8,8 +8,8 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|||||||
|
|
||||||
ARG APP
|
ARG APP
|
||||||
|
|
||||||
ENV NSQ_ADDR=${APP}-nsq:4150
|
ENV NSQ_ADDR=nsq:4150
|
||||||
ENV NSQ_TOPIC_PREFIX=${APP}
|
ENV NSQ_TOPIC_PREFIX=apipark
|
||||||
|
|
||||||
RUN mkdir -p /${APP}
|
RUN mkdir -p /${APP}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ source ./scripts/common.sh
|
|||||||
APP="apipark"
|
APP="apipark"
|
||||||
|
|
||||||
|
|
||||||
mkdir -p scripts/cmd/ && cp cmd/${APP} scripts/cmd/ && cp cmd/apipark_ai_event_listen scripts/cmd/
|
mkdir -p scripts/cmd/ && cp cmd/${APP} scripts/cmd/
|
||||||
|
|
||||||
VERSION=$(gen_version)
|
VERSION=$(gen_version)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ echo -e " - $s" >> config.yml
|
|||||||
done
|
done
|
||||||
echo -e "nsq:" >> config.yml
|
echo -e "nsq:" >> config.yml
|
||||||
echo -e " addr: ${NSQ_ADDR}" >> config.yml
|
echo -e " addr: ${NSQ_ADDR}" >> config.yml
|
||||||
echo -e " topic_prefix: ${NSQ_TOPIC_PREFIX}" >> config.yml
|
echo -e " topic: ${NSQ_TOPIC}" >> config.yml
|
||||||
echo -e "port: 8288" >> config.yml
|
echo -e "port: 8288" >> config.yml
|
||||||
echo -e "error_log:" >> config.yml
|
echo -e "error_log:" >> config.yml
|
||||||
echo -e " dir: ${ERROR_DIR}" >> config.yml
|
echo -e " dir: ${ERROR_DIR}" >> config.yml
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ type Provider struct {
|
|||||||
Name string `gorm:"type:varchar(100);not null;column:name;comment:name"`
|
Name string `gorm:"type:varchar(100);not null;column:name;comment:name"`
|
||||||
DefaultLLM string `gorm:"type:varchar(255);not null;column:default_llm;comment:默认模型ID"`
|
DefaultLLM string `gorm:"type:varchar(255);not null;column:default_llm;comment:默认模型ID"`
|
||||||
Config string `gorm:"type:text;not null;column:config;comment:配置信息"`
|
Config string `gorm:"type:text;not null;column:config;comment:配置信息"`
|
||||||
Status int `gorm:"type:tinyint(1);not null;column:status;comment:状态,0:停用;1:启用,2:异常;default:1"`
|
Status int `gorm:"type:tinyint(1);not null;column:status;comment:状态,0:停用;1:启用,2:异常"`
|
||||||
Priority int `gorm:"type:int;not null;column:priority;comment:优先级,值越小优先级越高"`
|
Priority int `gorm:"type:int;not null;column:priority;comment:优先级,值越小优先级越高"`
|
||||||
Creator string `gorm:"size:36;not null;column:creator;comment:创建人;index:creator" aovalue:"creator"` // 创建人
|
Creator string `gorm:"size:36;not null;column:creator;comment:创建人;index:creator" aovalue:"creator"` // 创建人
|
||||||
Updater string `gorm:"size:36;not null;column:updater;comment:更新人;index:updater" aovalue:"updater"` // 更新人
|
Updater string `gorm:"size:36;not null;column:updater;comment:更新人;index:updater" aovalue:"updater"` // 更新人
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ type Doc struct {
|
|||||||
Id int64 `gorm:"column:id;type:BIGINT(20);AUTO_INCREMENT;NOT NULL;comment:id;primary_key;comment:主键ID;"`
|
Id int64 `gorm:"column:id;type:BIGINT(20);AUTO_INCREMENT;NOT NULL;comment:id;primary_key;comment:主键ID;"`
|
||||||
UUID string `gorm:"type:varchar(36);not null;column:uuid;uniqueIndex:uuid;comment:UUID;"`
|
UUID string `gorm:"type:varchar(36);not null;column:uuid;uniqueIndex:uuid;comment:UUID;"`
|
||||||
Service string `gorm:"size:36;not null;column:service;comment:服务;index:service"`
|
Service string `gorm:"size:36;not null;column:service;comment:服务;index:service"`
|
||||||
Content string `gorm:"type:longtext;null;column:content;comment:文档内容"`
|
Content string `gorm:"type:text;null;column:content;comment:文档内容"`
|
||||||
Updater string `gorm:"size:36;not null;column:updater;comment:更新人;index:updater" aovalue:"updater"`
|
Updater string `gorm:"size:36;not null;column:updater;comment:更新人;index:updater" aovalue:"updater"`
|
||||||
UpdateAt time.Time `gorm:"type:timestamp;NOT NULL;DEFAULT:CURRENT_TIMESTAMP;column:update_at;comment:更新时间"`
|
UpdateAt time.Time `gorm:"type:timestamp;NOT NULL;DEFAULT:CURRENT_TIMESTAMP;column:update_at;comment:更新时间"`
|
||||||
APICount int64 `gorm:"type:int(11);not null;column:api_count;comment:接口数量"`
|
APICount int64 `gorm:"type:int(11);not null;column:api_count;comment:接口数量"`
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ type Commit[H any] struct {
|
|||||||
UUID string `gorm:"size:36;not null;column:uuid;comment:uuid;uniqueIndex:uuid;"`
|
UUID string `gorm:"size:36;not null;column:uuid;comment:uuid;uniqueIndex:uuid;"`
|
||||||
Target string `gorm:"column:target;type:varchar(36);NOT NULL;comment:目标id;index:target;"`
|
Target string `gorm:"column:target;type:varchar(36);NOT NULL;comment:目标id;index:target;"`
|
||||||
Key string `gorm:"size:50;not null;column:key;comment:类型;index:key;"`
|
Key string `gorm:"size:50;not null;column:key;comment:类型;index:key;"`
|
||||||
Data *H `gorm:"type:longtext;not null;column:data;comment:数据;charset=utf8mb4;serializer:json"`
|
Data *H `gorm:"type:text;not null;column:data;comment:数据;charset=utf8mb4;serializer:json"`
|
||||||
CreateAt time.Time `gorm:"type:timestamp;NOT NULL;DEFAULT:CURRENT_TIMESTAMP;column:create_at;comment:创建时间"`
|
CreateAt time.Time `gorm:"type:timestamp;NOT NULL;DEFAULT:CURRENT_TIMESTAMP;column:create_at;comment:创建时间"`
|
||||||
Operator string `gorm:"size:36;not null;column:operator;comment:操作人;index:operator;"`
|
Operator string `gorm:"size:36;not null;column:operator;comment:操作人;index:operator;"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user