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
5f034f5b
Unverified
Commit
5f034f5b
authored
Jun 28, 2024
by
royjhan
Committed by
GitHub
Jun 28, 2024
Browse files
Include Show Info in Interactive (#5342)
parent
b910fa90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
22 deletions
+12
-22
cmd/cmd.go
cmd/cmd.go
+11
-13
cmd/interactive.go
cmd/interactive.go
+1
-9
No files found.
cmd/cmd.go
View file @
5f034f5b
...
@@ -624,13 +624,13 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
...
@@ -624,13 +624,13 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
return
errors
.
New
(
"only one of '--license', '--modelfile', '--parameters', '--system', or '--template' can be specified"
)
return
errors
.
New
(
"only one of '--license', '--modelfile', '--parameters', '--system', or '--template' can be specified"
)
}
}
if
flagsSet
==
1
{
req
:=
api
.
ShowRequest
{
Name
:
args
[
0
]}
req
:=
api
.
ShowRequest
{
Name
:
args
[
0
]}
resp
,
err
:=
client
.
Show
(
cmd
.
Context
(),
&
req
)
resp
,
err
:=
client
.
Show
(
cmd
.
Context
(),
&
req
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
if
flagsSet
==
1
{
switch
showType
{
switch
showType
{
case
"license"
:
case
"license"
:
fmt
.
Println
(
resp
.
License
)
fmt
.
Println
(
resp
.
License
)
...
@@ -647,12 +647,12 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
...
@@ -647,12 +647,12 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
return
nil
return
nil
}
}
req
:=
api
.
ShowRequest
{
Name
:
args
[
0
]}
showInfo
(
resp
)
resp
,
err
:=
client
.
Show
(
cmd
.
Context
(),
&
req
)
if
err
!=
nil
{
return
err
}
return
nil
}
func
showInfo
(
resp
*
api
.
ShowResponse
)
{
arch
:=
resp
.
ModelInfo
[
"general.architecture"
]
.
(
string
)
arch
:=
resp
.
ModelInfo
[
"general.architecture"
]
.
(
string
)
modelData
:=
[][]
string
{
modelData
:=
[][]
string
{
...
@@ -711,8 +711,6 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
...
@@ -711,8 +711,6 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
}
}
table
.
Render
()
table
.
Render
()
return
nil
}
}
func
renderSubTable
(
data
[][]
string
,
file
bool
)
string
{
func
renderSubTable
(
data
[][]
string
,
file
bool
)
string
{
...
...
cmd/interactive.go
View file @
5f034f5b
...
@@ -404,15 +404,7 @@ func generateInteractive(cmd *cobra.Command, opts runOptions) error {
...
@@ -404,15 +404,7 @@ func generateInteractive(cmd *cobra.Command, opts runOptions) error {
switch
args
[
1
]
{
switch
args
[
1
]
{
case
"info"
:
case
"info"
:
fmt
.
Println
(
"Model details:"
)
showInfo
(
resp
)
if
len
(
resp
.
Details
.
Families
)
>
0
{
fmt
.
Printf
(
"Family %s
\n
"
,
strings
.
Join
(
resp
.
Details
.
Families
,
", "
))
}
else
if
resp
.
Details
.
Family
!=
""
{
fmt
.
Printf
(
"Family %s
\n
"
,
resp
.
Details
.
Family
)
}
fmt
.
Printf
(
"Parameter Size %s
\n
"
,
resp
.
Details
.
ParameterSize
)
fmt
.
Printf
(
"Quantization Level %s
\n
"
,
resp
.
Details
.
QuantizationLevel
)
fmt
.
Println
(
""
)
case
"license"
:
case
"license"
:
if
resp
.
License
==
""
{
if
resp
.
License
==
""
{
fmt
.
Println
(
"No license was specified for this model."
)
fmt
.
Println
(
"No license was specified for this model."
)
...
...
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