Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

None 没有判断导致的报错 #10

Open
chinachenjunben opened this issue Dec 5, 2023 · 0 comments
Open

None 没有判断导致的报错 #10

chinachenjunben opened this issue Dec 5, 2023 · 0 comments

Comments

@chinachenjunben
Copy link

chinachenjunben commented Dec 5, 2023

/home/ubuntu/sdwebui-api-manager/app/manager/reqq.py 142行需要增加None判断。
修改:

def compare_options(options):  
    global current_options  
    print("options:", options)  # 打印 options 看看它的值是什么  
    if options is None or len(options) == 0:  # 检查 options 是否为 None 或者空字典  
        print("Warning: Empty options")  
        return  
    current_options = {}  # 初始化 current_options 为一个空字典  
    is_change = False  
    print("compare_options", options)  
    for k, v in options.items():  
        if (current_options.get(k) != v):  
            is_change = True  
            break  
   
    if (is_change):  
        current_options = copy.deepcopy(options)  
        print("start to set options to api", current_options)  
        api.set_options(options)  # 确保 api 在此之前被定义
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant