mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-12 00:37:04 +00:00
rename model to model_name to avoid collision
This commit is contained in:
committed by
Michael Yang
parent
af66c5695a
commit
5cea13ce00
@@ -1,16 +1,16 @@
|
||||
import os
|
||||
from os import path
|
||||
from difflib import SequenceMatcher
|
||||
from jinja2 import Environment, PackageLoader
|
||||
|
||||
|
||||
def template(model, prompt):
|
||||
def template(name, prompt):
|
||||
best_ratio = 0
|
||||
best_template = ''
|
||||
|
||||
environment = Environment(loader=PackageLoader(__name__, 'templates'))
|
||||
for template in environment.list_templates():
|
||||
base, _ = os.path.splitext(template)
|
||||
ratio = SequenceMatcher(None, os.path.basename(model.lower()), base).ratio()
|
||||
base, _ = path.splitext(template)
|
||||
ratio = SequenceMatcher(None, path.basename(name).lower(), base).ratio()
|
||||
if ratio > best_ratio:
|
||||
best_ratio = ratio
|
||||
best_template = template
|
||||
|
||||
Reference in New Issue
Block a user