mirror of
https://github.com/ollama/ollama.git
synced 2026-03-27 02:58:43 +07:00
clean up
This commit is contained in:
@@ -1168,23 +1168,21 @@ func (s *Server) ShowHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// For local (non-remote) models, override the context_length in ModelInfo
|
||||
// with the server's effective context length so clients see what the model
|
||||
// will actually run with, not just the training context from the GGUF file.
|
||||
// For local models, override the context_length in ModelInfo
|
||||
// with the server's context length so clients see what the model
|
||||
// will actually run with, not just the context from the GGUF file.
|
||||
if resp.RemoteHost == "" && resp.ModelInfo != nil && m != nil {
|
||||
effectiveCtx := int(envconfig.ContextLength())
|
||||
if effectiveCtx == 0 {
|
||||
effectiveCtx = s.defaultNumCtx
|
||||
}
|
||||
|
||||
// Apply model-level num_ctx override if set
|
||||
if numCtx, ok := m.Options["num_ctx"]; ok {
|
||||
if v, ok := numCtx.(float64); ok {
|
||||
effectiveCtx = int(v)
|
||||
}
|
||||
}
|
||||
|
||||
// Find and override the {arch}.context_length key
|
||||
for k := range resp.ModelInfo {
|
||||
if strings.HasSuffix(k, ".context_length") {
|
||||
resp.ModelInfo[k] = effectiveCtx
|
||||
|
||||
Reference in New Issue
Block a user