Giter VIP home page Giter VIP logo

Comments (10)

Calcium-Ion avatar Calcium-Ion commented on September 15, 2024

image
image

测试无法复现

from new-api.

123hi123 avatar 123hi123 commented on September 15, 2024

image image

测试无法复现

嗯,它會產生這樣的bug前提是你的渠道,當中要有人去提供這樣的一個模型
打個比方說你有一個渠道,有提供 claude 的模型,然後另外一個提供 gpt 的模型
然後你有一個令牌限制,只能用 gpt 的模型
這個時候,如果你用 models 去抓的話,會抓到兩個模型
可能再麻煩你試試看了

from new-api.

Calcium-Ion avatar Calcium-Ion commented on September 15, 2024

我的渠道肯定是有claude-3-5-sonnet-20240620这个模型的

from new-api.

123hi123 avatar 123hi123 commented on September 15, 2024

我的渠道肯定是有claude-3-5-sonnet-20240620这个模型的

那我下午的時候用你的方法測試一下
目前猜測是open webui 連false的模型也會抓 🤔

from new-api.

123hi123 avatar 123hi123 commented on September 15, 2024

嗯,這個 bug 要產生是請求頭 models 才會發生
使用到的測試代碼如下 記得填入你自己的呃認證的 key

可能需要的認證token

headers["Authorization"] = ""

from tabulate import tabulate

# 設置API的基礎URL
base_url = "http://localhost:9090/v1"

# 設置headers
headers = {
    "Content-Type": "application/json"
}

# 可能需要的認證token
headers["Authorization"] = ""

def get_models():
    try:
        response = requests.get(f"{base_url}/models", headers=headers)
        response.raise_for_status()  # 如果請求不成功則拋出異常
        return response.json()
    except requests.RequestException as e:
        print(f"發生錯誤: {e}")
        return None

# 執行請求並處理結果
models = get_models()
if models and 'data' in models:
    # 提取所有模型的id
    model_ids = [model['id'] for model in models['data']]
    
    # 使用tabulate創建一個漂亮的表格
    table = tabulate([[id] for id in model_ids], headers=['Model ID'], tablefmt='fancy_grid')
    
    print("可用的模型:")
    print(table)
else:
    print("無法獲取模型列表或列表為空。")```
  以下截取一部分的返回結果
  裏面可以清楚的看到有一些我沒有允許通過的模型
  
![image](https://github.com/user-attachments/assets/a2f50e93-acfb-470a-a165-d99b4ee69065)
![image](https://github.com/user-attachments/assets/20b32b0b-fea2-4098-a83d-db3d07ff4c55)
我有且僅有這一個 api key
  

from new-api.

123hi123 avatar 123hi123 commented on September 15, 2024

@Calcium-Ion

from new-api.

Yan-Zero avatar Yan-Zero commented on September 15, 2024

模型列表获取和能否请求是两码事,而且OpenWebUI本身支持白名单模型

from new-api.

123hi123 avatar 123hi123 commented on September 15, 2024

模型列表获取和能否请求是两码事,而且OpenWebUI本身支持白名单模型

多謝回覆 看來是我描述錯誤issues 那想問一下 new api之後可能會支持把models接口所展示出來的模型列表也一併限制嗎

from new-api.

Calcium-Ion avatar Calcium-Ion commented on September 15, 2024

模型列表获取和能否请求是两码事,而且OpenWebUI本身支持白名单模型

多謝回覆 看來是我描述錯誤issues 那想問一下 new api之後可能會支持把models接口所展示出來的模型列表也一併限制嗎

你应该重新开一个issue描述这个问题

from new-api.

123hi123 avatar 123hi123 commented on September 15, 2024

from new-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.