Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0ca336b9
authored
Nov 23, 2023
by
Calcium-Ion
Committed by
GitHub
Nov 23, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13 from AI-ASS/main
fix the issue of model repetition
parents
3146624d
745ba3ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
model/ability.go
+4
-8
No files found.
model/ability.go
View file @
0ca336b9
...
@@ -14,14 +14,10 @@ type Ability struct {
...
@@ -14,14 +14,10 @@ type Ability struct {
}
}
func
GetGroupModels
(
group
string
)
[]
string
{
func
GetGroupModels
(
group
string
)
[]
string
{
var
abilities
[]
Ability
var
models
[]
string
//去重 enabled = true
// Find distinct models
DB
.
Where
(
"`group` = ? and enabled = ?"
,
group
,
true
)
.
Find
(
&
abilities
)
DB
.
Table
(
"abilities"
)
.
Where
(
"`group` = ? and enabled = ?"
,
group
,
true
)
.
Distinct
(
"model"
)
.
Pluck
(
"model"
,
&
models
)
models
:=
make
([]
string
,
0
,
len
(
abilities
))
return
models
for
_
,
ability
:=
range
abilities
{
models
=
append
(
models
,
ability
.
Model
)
}
return
models
}
}
func
GetRandomSatisfiedChannel
(
group
string
,
model
string
)
(
*
Channel
,
error
)
{
func
GetRandomSatisfiedChannel
(
group
string
,
model
string
)
(
*
Channel
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment