File size: 1,329 Bytes
4688574
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from app.utils import cleanup_url

# https://huggingface.co/phate334/Llama-3.1-8B-Instruct-Q4_K_M-GGUF/resolve/main/llama-3.1-8b-instruct-q4_k_m.gguf?download=true
# https://huggingface.co/phate334/Llama-3.1-8B-Instruct-Q4_K_M-GGUF/resolve/main/llama-3.1-8b-instruct-q4_k_m.gguf
# https://huggingface.co/phate334/Llama-3.1-8B-Instruct-Q4_K_M-GGUF/blob/main/llama-3.1-8b-instruct-q4_k_m.gguf
# cleanup_url 輸出都應該要是 https://huggingface.co/phate334/Llama-3.1-8B-Instruct-Q4_K_M-GGUF/resolve/main/llama-3.1-8b-instruct-q4_k_m.gguf
# 其餘非 huggingface.co 的 url 只要前後沒有空白就好

resolve_url = "https://huggingface.co/phate334/Llama-3.1-8B-Instruct-Q4_K_M-GGUF/resolve/main/llama-3.1-8b-instruct-q4_k_m.gguf"
resolve_url_download = "https://huggingface.co/phate334/Llama-3.1-8B-Instruct-Q4_K_M-GGUF/resolve/main/llama-3.1-8b-instruct-q4_k_m.gguf?download=true"
blob_url = "https://huggingface.co/phate334/Llama-3.1-8B-Instruct-Q4_K_M-GGUF/blob/main/llama-3.1-8b-instruct-q4_k_m.gguf"
other_url = "https://git.gss.com.tw/phate_wang/llm/llama-3.1-8b-instruct-q4_k_m.gguf"


def test_cleanup_url():
    assert cleanup_url(resolve_url) == resolve_url
    assert cleanup_url(resolve_url_download) == resolve_url
    assert cleanup_url(blob_url) == resolve_url
    assert cleanup_url(other_url) == other_url