-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: ListModels Filtering Upgrade #2773
Merged
dave-gray101
merged 67 commits into
mudler:master
from
dave-gray101:gw-list-model-filter-upgrade
Oct 1, 2024
+386
−80
Merged
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
d170bb7
seperate the filtering from the middleware changes
dave-gray101 9012344
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 d5d6837
merge with 2772, since ListModels now has an easy way to include loos…
dave-gray101 688cddc
fix backwards bool, add documentation to explain why
dave-gray101 d9443cf
fix another backwards bool
dave-gray101 41c1ecc
fix another backwards bool
dave-gray101 0ced357
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 d2699d2
clean
dave-gray101 380282d
pay attention while coding
dave-gray101 865aad4
pay attention while coding
dave-gray101 fd92e81
fix
dave-gray101 7115941
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 bbd56bd
fix
dave-gray101 aace492
Merge branch 'gw-list-model-filter-upgrade' of ghgray101:/dave-gray10…
dave-gray101 ffe1006
bad merge
dave-gray101 cffb148
fix
dave-gray101 845bb83
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 46b651b
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 ca462c8
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 39ab1fd
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 474a417
fix pointer change
dave-gray101 7d731f5
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 794c359
fix merge error in a test
dave-gray101 b23f0c0
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 1d279ff
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 c6ca55f
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 5c1b603
ALWAYS_INCLUDE ==> SKIP_IF_CONFIGURED see #3107 and #3011
dave-gray101 f3e9759
automerge
dave-gray101 579ee54
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 a56dda7
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 6182737
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 a9e97ae
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 569f03b
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 6357b41
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 a0f7888
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 f48f62f
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 0ad9b72
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 bec39f2
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 a16790a
update for SoundGeneration
dave-gray101 7cb71c7
missed file
dave-gray101 f2c4fb4
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 66f7826
re-add fix lost in DCO force push
dave-gray101 6c8c00f
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 5ad8943
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 9cb2d0c
add cli command
dave-gray101 2e8c010
manual merge
dave-gray101 5c22b95
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 8aa637f
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 595bc8f
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 67d6bf2
experimental workflow fix to unbreak
dave-gray101 d68dcca
revert
dave-gray101 320ab30
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 f9dd9d2
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 1b50daa
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 0e77ac2
allow manually adding usecases
dave-gray101 898b6be
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 258c9bd
fix
dave-gray101 204d6a1
fix
dave-gray101 0b43fad
fix
dave-gray101 64d2f63
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 f68d54e
test change
dave-gray101 e67fcce
Merge branch 'gw-list-model-filter-upgrade' of ghgray101:/dave-gray10…
dave-gray101 7589128
test fix
dave-gray101 45c809c
oops
dave-gray101 d4224e3
oops
dave-gray101 d750dc6
Merge branch 'master' into gw-list-model-filter-upgrade
mudler 68a1006
Merge branch 'master' into gw-list-model-filter-upgrade
dave-gray101 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package config | ||
|
||
import "regexp" | ||
|
||
type BackendConfigFilterFn func(string, *BackendConfig) bool | ||
|
||
func NoFilterFn(_ string, _ *BackendConfig) bool { return true } | ||
|
||
func BuildNameFilterFn(filter string) (BackendConfigFilterFn, error) { | ||
if filter == "" { | ||
return NoFilterFn, nil | ||
} | ||
rxp, err := regexp.Compile(filter) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return func(name string, config *BackendConfig) bool { | ||
if config != nil { | ||
return rxp.MatchString(config.Name) | ||
} | ||
return rxp.MatchString(name) | ||
}, nil | ||
} | ||
|
||
func BuildUsecaseFilterFn(usecases BackendConfigUsecases) BackendConfigFilterFn { | ||
if usecases == FLAG_ANY { | ||
return NoFilterFn | ||
} | ||
return func(name string, config *BackendConfig) bool { | ||
if config == nil { | ||
return false // TODO: Potentially make this a param, for now, no known usecase to include | ||
} | ||
return config.HasUsecases(usecases) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another optimization down the line is to extract the backend list here at the top of the file in a map or either a list for easing out maintenance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that idea. I plan to do some more refactoring around the services, and I think the best place to locate that list will be over there. Thanks!
ttsService.GetKnownBackends() or something similar - not ruling out putting it above here, just seems a bit strange to maintain an ongoing list of backends in the config subdir :)