This repository was archived by the owner on Jun 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
Update the muxing rules to v3 #1112
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Next
Next commit
Update the muxing rules to v3
Closes: #1060 Right now the muxing rules are designed to catch globally FIM or Chat requests. This PR extends its functionality to be able to match per file and request, i.e. this PR enables - Chat request of main.py -> model 1 - FIM request of main.py -> model 2 - Any type of v1.py -> model 3
- Loading branch information
commit 161737acbff37c9004446b3c094a75feab7b9d3c
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
migrations/versions/2025_02_19_1452-5e5cd2288147_update_matcher_types.py
This file contains hidden or 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,79 @@ | ||
| """update matcher types | ||
|
|
||
| Revision ID: 5e5cd2288147 | ||
| Revises: 0c3539f66339 | ||
| Create Date: 2025-02-19 14:52:39.126196+00:00 | ||
|
|
||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "5e5cd2288147" | ||
| down_revision: Union[str, None] = "0c3539f66339" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| # Begin transaction | ||
| op.execute("BEGIN TRANSACTION;") | ||
|
|
||
| # Update the matcher types. We need to do this every time we change the matcher types. | ||
| # in /muxing/models.py | ||
| op.execute( | ||
| """ | ||
| UPDATE muxes | ||
| SET matcher_type = 'fim', matcher_blob = '' | ||
| WHERE matcher_type = 'request_type_match' AND matcher_blob = 'fim'; | ||
| """ | ||
| ) | ||
| op.execute( | ||
| """ | ||
| UPDATE muxes | ||
| SET matcher_type = 'chat', matcher_blob = '' | ||
| WHERE matcher_type = 'request_type_match' AND matcher_blob = 'chat'; | ||
| """ | ||
| ) | ||
| op.execute( | ||
| """ | ||
| UPDATE muxes | ||
| SET matcher_type = 'catch_all' | ||
| WHERE matcher_type = 'filename_match' AND matcher_blob != ''; | ||
| """ | ||
| ) | ||
|
|
||
| # Finish transaction | ||
| op.execute("COMMIT;") | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| # Begin transaction | ||
| op.execute("BEGIN TRANSACTION;") | ||
|
|
||
| op.execute( | ||
| """ | ||
| UPDATE muxes | ||
| SET matcher_blob = 'fim', matcher_type = 'request_type_match' | ||
| WHERE matcher_type = 'fim'; | ||
| """ | ||
| ) | ||
| op.execute( | ||
| """ | ||
| UPDATE muxes | ||
| SET matcher_blob = 'chat', matcher_type = 'request_type_match' | ||
| WHERE matcher_type = 'chat'; | ||
| """ | ||
| ) | ||
| op.execute( | ||
| """ | ||
| UPDATE muxes | ||
| SET matcher_type = 'filename_match', matcher_blob = 'catch_all' | ||
| WHERE matcher_type = 'catch_all'; | ||
| """ | ||
| ) | ||
|
|
||
| # Finish transaction | ||
| op.execute("COMMIT;") |
This file contains hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.