vscode-ai-toolkit icon indicating copy to clipboard operation
vscode-ai-toolkit copied to clipboard

Invalid URL and can't load any models to modal catalog

Open chunlea opened this issue 1 year ago • 6 comments

I got this invalid URL after I want to set up ollama URL.

Debug: Microsoft.Neutron.OpenAI.Provider.OpenAIServiceProviderOnnx [0]  2024-11-07T22:57:30.459752-08:00 GetLoadedModels
Debug: Microsoft.Neutron.OpenAI.Provider.OpenAIServiceProviderOnnx [0]  2024-11-07T22:57:30.459752-08:00 GetLoadedModels
Debug: Microsoft.Neutron.OpenAI.Provider.OpenAIServiceLlamaSharp [0]  2024-11-07T22:57:30.460362-08:00 GetLoadedModels
Debug: Microsoft.Neutron.OpenAI.Provider.OpenAIServiceLlamaSharp [0]  2024-11-07T22:57:30.460362-08:00 GetLoadedModels
Debug: Microsoft.Neutron.OpenAI.Provider.OpenAIServiceProviderOnnx [0]  2024-11-07T22:57:30.462774-08:00 GetModels
Debug: Microsoft.Neutron.OpenAI.Provider.OpenAIServiceProviderOnnx [0]  2024-11-07T22:57:30.462774-08:00 GetModels
[2024-11-08T06:57:30.740Z] [ERROR] Invalid URL 

but what is this Invalid URL? I can't find any settings stored the URL, can't reset. But I do able to check github models before, but now all failed.

OS version: macOS 15.2 Beta (24C5073e)

chunlea avatar Nov 08 '24 06:11 chunlea

The same here, with macOS Sonoma 14.6

victorelcaminas avatar Nov 09 '24 10:11 victorelcaminas

After reading the setting file at ~/.vscode/extensions/ms-windows-ai-studio.windows-ai-studio-0.6.0-darwin-arm64/bin/appsettings.json, I resolved this issue by deleting the entire ~/.aitk folder! (rm -rf ~/.aitk)

chunlea avatar Nov 09 '24 18:11 chunlea

Thank you very much, @chunlea. That worked!

victorelcaminas avatar Nov 09 '24 23:11 victorelcaminas

Please check out this document for adding Ollama models to AI Toolkit. According to this document, the URL format should be like this:

Use "http://localhost:11434/v1/chat/completions" as URL and leave auth empty.

Normally, if you accidentally input the wrong URL, you can right click and edit it.

Image

If it goes wrong, you can use @chunlea's workaround as last resort. But be aware that this will DELETE EVERYTHING stored in AI Toolkit.

After reading the setting file at ~/.vscode/extensions/ms-windows-ai-studio.windows-ai-studio-0.6.0-darwin-arm64/bin/appsettings.json, I resolved this issue by deleting the entire ~/.aitk folder! (rm -rf ~/.aitk)

a1exwang avatar Nov 12 '24 08:11 a1exwang

@chunlea Do you still have any questions? If not, I will close this issue.

a1exwang avatar Nov 12 '24 08:11 a1exwang

@a1exwang The problem is that when you enter a wrong URL, you can no longer edit anything—at least in Mac OS. It deletes everything and prevents you from getting a new model.

victorelcaminas avatar Nov 12 '24 10:11 victorelcaminas

@a1exwang The problem is that when you enter a wrong URL, you can no longer edit anything—at least in Mac OS. It deletes everything and prevents you from getting a new model.

Oh, now I get it. I can reproduces on Windows as well. Opened bug in internal bug tracker. 2300731

a1exwang avatar Nov 13 '24 04:11 a1exwang

Before this bug is fixed, if anyone encounters this bug, use the following workaround to unblock yourself:

  1. Find my-models.yml file

    • Windows: C:\Users\<username>\.aitk\models\my-models.yml
    • macOS: /Users/<username>/.aitk/models/my-models.yml
    • Linux: /home/<username>/.aitk/models/my-models.yml
  2. Find the section of the invalid model you added. You can find it in providers > a object with name Custom > models

    version: v0.1
    providers:
      - name: Custom
        models:
    -      - name: <the display name of your custom model>
    -        chat_completion_url: <your invalid URL>
    -        headers:
    -          {}
    -        api_model_name: <the name of your custom model>
    ...
    
  3. Restart Visual Studio Code.

Please be careful not to mess up this config file, otherwise, you may lose models you downloaded or added in AI Toolkit. And you should be noted that this file is internal to AI Toolkit, you should only edit it for this workaround and its schema could change in the future.

a1exwang avatar Nov 13 '24 04:11 a1exwang

The fix will be in the next version. Don't close until next release.

a1exwang avatar Nov 14 '24 07:11 a1exwang