mirror of
https://github.com/ollama/ollama.git
synced 2026-03-27 02:58:43 +07:00
address comments
This commit is contained in:
@@ -471,7 +471,7 @@ func (c *launcherClient) launchSingleIntegration(ctx context.Context, name strin
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := confirmLowContextLength(ctx, c.apiClient, []string{target}); err != nil {
|
||||
if err := lowContextLength(ctx, c.apiClient, []string{target}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ func (c *launcherClient) launchEditorIntegration(ctx context.Context, name strin
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := confirmLowContextLength(ctx, c.apiClient, models); err != nil {
|
||||
if err := lowContextLength(ctx, c.apiClient, models); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -1609,7 +1609,7 @@ func TestConfirmLowContextLength(t *testing.T) {
|
||||
r, w, _ := os.Pipe()
|
||||
os.Stderr = w
|
||||
|
||||
err = confirmLowContextLength(context.Background(), client, tt.models)
|
||||
err = lowContextLength(context.Background(), client, tt.models)
|
||||
|
||||
w.Close()
|
||||
var buf bytes.Buffer
|
||||
@@ -1673,9 +1673,9 @@ func TestParseNumCtxFromParameters(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := parseNumCtxFromParameters(tt.parameters)
|
||||
got := parseNumCtx(tt.parameters)
|
||||
if got != tt.want {
|
||||
t.Fatalf("parseNumCtxFromParameters(%q) = %d, want %d", tt.parameters, got, tt.want)
|
||||
t.Fatalf("parseNumCtx(%q) = %d, want %d", tt.parameters, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ func lowContextLength(ctx context.Context, client *api.Client, models []string)
|
||||
effectiveCtx := serverCtx
|
||||
modelfileOverride := false
|
||||
if info, err := client.Show(ctx, &api.ShowRequest{Model: m}); err == nil {
|
||||
if numCtx := parseNumCtxFromParameters(info.Parameters); numCtx > 0 {
|
||||
if numCtx := parseNumCtx(info.Parameters); numCtx > 0 {
|
||||
effectiveCtx = numCtx
|
||||
modelfileOverride = true
|
||||
}
|
||||
|
||||
@@ -1926,6 +1926,7 @@ func (s *Server) StatusHandler(c *gin.Context) {
|
||||
|
||||
contextLength := int(envconfig.ContextLength())
|
||||
if contextLength == 0 {
|
||||
slog.Warn("OLLAMA_CONTEXT_LENGTH is not set, using default", "default", s.defaultNumCtx)
|
||||
contextLength = s.defaultNumCtx
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user