Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
52ebe67a
Unverified
Commit
52ebe67a
authored
Apr 17, 2024
by
Michael Yang
Committed by
GitHub
Apr 17, 2024
Browse files
Merge pull request #3714 from ollama/mxyng/model-name-host
types/model: support : in PartHost for host:port
parents
c8afe716
889b31ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
types/model/name.go
types/model/name.go
+5
-0
types/model/name_test.go
types/model/name_test.go
+1
-0
No files found.
types/model/name.go
View file @
52ebe67a
...
@@ -521,6 +521,8 @@ func parts(s string) iter_Seq2[PartKind, string] {
...
@@ -521,6 +521,8 @@ func parts(s string) iter_Seq2[PartKind, string] {
return
return
}
}
state
,
j
,
partLen
=
PartModel
,
i
,
0
state
,
j
,
partLen
=
PartModel
,
i
,
0
case
PartHost
:
// noop: support for host:port
default
:
default
:
yield
(
PartExtraneous
,
s
[
i
+
1
:
j
])
yield
(
PartExtraneous
,
s
[
i
+
1
:
j
])
return
return
...
@@ -678,6 +680,9 @@ func isValidByteFor(kind PartKind, c byte) bool {
...
@@ -678,6 +680,9 @@ func isValidByteFor(kind PartKind, c byte) bool {
if
kind
==
PartNamespace
&&
c
==
'.'
{
if
kind
==
PartNamespace
&&
c
==
'.'
{
return
false
return
false
}
}
if
kind
==
PartHost
&&
c
==
':'
{
return
true
}
if
c
==
'.'
||
c
==
'-'
{
if
c
==
'.'
||
c
==
'-'
{
return
true
return
true
}
}
...
...
types/model/name_test.go
View file @
52ebe67a
...
@@ -40,6 +40,7 @@ var testNames = map[string]fields{
...
@@ -40,6 +40,7 @@ var testNames = map[string]fields{
"user/model"
:
{
namespace
:
"user"
,
model
:
"model"
},
"user/model"
:
{
namespace
:
"user"
,
model
:
"model"
},
"example.com/ns/mistral:7b+Q4_0"
:
{
host
:
"example.com"
,
namespace
:
"ns"
,
model
:
"mistral"
,
tag
:
"7b"
,
build
:
"Q4_0"
},
"example.com/ns/mistral:7b+Q4_0"
:
{
host
:
"example.com"
,
namespace
:
"ns"
,
model
:
"mistral"
,
tag
:
"7b"
,
build
:
"Q4_0"
},
"example.com/ns/mistral:7b+X"
:
{
host
:
"example.com"
,
namespace
:
"ns"
,
model
:
"mistral"
,
tag
:
"7b"
,
build
:
"X"
},
"example.com/ns/mistral:7b+X"
:
{
host
:
"example.com"
,
namespace
:
"ns"
,
model
:
"mistral"
,
tag
:
"7b"
,
build
:
"X"
},
"localhost:5000/ns/mistral"
:
{
host
:
"localhost:5000"
,
namespace
:
"ns"
,
model
:
"mistral"
},
// invalid digest
// invalid digest
"mistral:latest@invalid256-"
:
{},
"mistral:latest@invalid256-"
:
{},
...
...
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