diff --git a/README.vi.md b/README.vi.md index ab623c5..9de4caa 100644 --- a/README.vi.md +++ b/README.vi.md @@ -171,6 +171,8 @@ curl http://localhost:8080/v1/systemone \ System One ghép một state tự do với các câu hỏi có kiểu và trả về câu trả lời có kiểu, nên payload này không dùng chung hình dạng với cầu nối chat/responses và được chuyển tiếp nguyên văn, không bao giờ dịch. Chỉ những mô hình có giao thức gốc là System One mới được phục vụ tại đây; một payload quyết định gửi tới endpoint message (`/v1/chat/completions`, `/v1/responses`) cũng được chuyển tiếp nguyên văn thay vì chuyển đổi. Câu trả lời streaming từ upstream được chuyển tiếp nguyên trạng, không khôi phục luồng. +Để kiểm tra các mô hình và lưu ID của những mô hình gọi thành công vào `working-models.txt`, chạy `bash scripts/check-models.sh`. Script dùng `config.json` để lấy `server_keys` và sẽ hỏi xác nhận trước khi gửi request; thêm `--yes` để bỏ qua xác nhận. + ### Ranh giới tương thích Request dùng giao thức gốc của upstream sẽ giữ nguyên các trường riêng của nhà cung cấp. Request đi qua nhiều giao thức sẽ đi qua một biểu diễn chung; không phải tuỳ chọn nào cũng có phần tương đương. Ví dụ, ràng buộc output JSON của Chat và `seed` không được chuyển tiếp sang Anthropic Messages. Nội dung hoặc loại tool không được hỗ trợ có thể bị từ chối. diff --git a/scripts/check-models.sh b/scripts/check-models.sh index a122c94..d86c746 100755 --- a/scripts/check-models.sh +++ b/scripts/check-models.sh @@ -33,7 +33,8 @@ fi BASE_URL=${BASE_URL%/} models_file=$(mktemp) response_file=$(mktemp) -trap 'rm -f "$models_file" "$response_file"' EXIT +working_models_tmp=$(mktemp ./.working-models.txt.tmp.XXXXXX) +trap 'rm -f "$models_file" "$response_file" "$working_models_tmp"' EXIT if ! curl -sS --fail-with-body "$BASE_URL/v1/models" \ -H "Authorization: Bearer $API_KEY" -o "$models_file"; then @@ -50,7 +51,12 @@ fi model_count=$(jq '.data | length' "$models_file") if [[ "$model_count" -eq 0 ]]; then + if ! mv -f "$working_models_tmp" working-models.txt; then + printf 'Could not write working-models.txt\n' >&2 + exit 1 + fi printf 'No models were returned by %s/v1/models\n' "$BASE_URL" + printf 'An empty model list was saved to working-models.txt\n' exit 0 fi @@ -109,6 +115,7 @@ while IFS=$'\t' read -r model protocol; do if [[ "$curl_ok" == true && "$status" =~ ^2[0-9][0-9]$ ]] \ && jq -e 'type == "object" and (has("error") | not)' "$response_file" >/dev/null 2>&1; then printf 'PASS %s (%s, HTTP %s)\n' "$model" "$protocol" "$status" + printf '%s\n' "$model" >> "$working_models_tmp" passed=$((passed + 1)) else message=$(jq -r '.error.message // .message // empty' "$response_file" 2>/dev/null | head -c 200) @@ -121,8 +128,14 @@ while IFS=$'\t' read -r model protocol; do fi done < <(jq -r '.data[] | [.id, (.native_protocol // "chat")] | @tsv' "$models_file") +if ! mv -f "$working_models_tmp" working-models.txt; then + printf 'Could not write working-models.txt\n' >&2 + exit 1 +fi + printf '\nSummary: %s passed, %s failed, %s skipped (total %s)\n' \ "$passed" "$failed" "$skipped" "$model_count" +printf 'Working model list saved to working-models.txt\n' if [[ "$failed" -gt 0 || "$skipped" -gt 0 ]]; then exit 1 fi \ No newline at end of file