()
| 7908 | }); |
| 7909 | |
| 7910 | // Initialize URL container visibility |
| 7911 | $('#carrot_rag_alt_url_container').toggle(ragState.useAltUrl || false); |
| 7912 | |
| 7913 | // Toggle function for vectorization model settings |
| 7914 | function toggleRAGVectorSettings() { |
| 7915 | const source = ragState.vectorSource || 'transformers'; |
| 7916 | |
| 7917 | // Hide all model containers |
| 7918 | $('#carrot_rag_openai_model_container').hide(); |
| 7919 | $('#carrot_rag_cohere_model_container').hide(); |
| 7920 | $('#carrot_rag_google_model_container').hide(); |
| 7921 | $('#carrot_rag_togetherai_model_container').hide(); |
| 7922 | $('#carrot_rag_ollama_model_container').hide(); |
| 7923 | $('#carrot_rag_ollama_keep_container').hide(); |
| 7924 | $('#carrot_rag_vllm_model_container').hide(); |
| 7925 | $('#carrot_rag_webllm_model_container').hide(); |
| 7926 | $('#carrot_rag_llamacpp_info').hide(); |
| 7927 | $('#carrot_rag_nomicai_container').hide(); |
| 7928 | $('#carrot_rag_url_settings').hide(); |
| 7929 | |
| 7930 | // Sources that require URL settings |
| 7931 | const urlRequiredSources = ['ollama', 'llamacpp', 'koboldcpp', 'vllm']; |
| 7932 | const showUrlSettings = urlRequiredSources.includes(source); |
| 7933 | |
| 7934 | // Update URL hint text based on source |
| 7935 | const urlHints = { |
| 7936 | 'ollama': 'Set the Ollama URL in the Text Completion API connection settings.', |
| 7937 | 'llamacpp': 'Set the llama.cpp URL in the Text Completion API connection settings.', |
| 7938 | 'koboldcpp': 'Set the KoboldCpp URL in the Text Completion API connection settings.', |
| 7939 | 'vllm': 'Set the vLLM URL in the Text Completion API connection settings.' |
| 7940 | }; |
| 7941 | |
| 7942 | if (showUrlSettings) { |
| 7943 | $('#carrot_rag_url_settings').show(); |
| 7944 | $('#carrot_rag_url_hint_text').text(urlHints[source] || ''); |
| 7945 | } |
| 7946 | |
| 7947 | // Show relevant model container based on source |
| 7948 | switch (source) { |
| 7949 | case 'openai': |
| 7950 | case 'mistral': |
| 7951 | $('#carrot_rag_openai_model_container').show(); |
| 7952 | break; |
| 7953 | case 'cohere': |
| 7954 | $('#carrot_rag_cohere_model_container').show(); |
| 7955 | break; |
| 7956 | case 'palm': |
| 7957 | case 'vertexai': |
| 7958 | $('#carrot_rag_google_model_container').show(); |
| 7959 | break; |
| 7960 | case 'togetherai': |
| 7961 | $('#carrot_rag_togetherai_model_container').show(); |
| 7962 | break; |
| 7963 | case 'ollama': |
| 7964 | $('#carrot_rag_ollama_model_container').show(); |
| 7965 | $('#carrot_rag_ollama_keep_container').show(); |
| 7966 | break; |
| 7967 | case 'vllm': |
no test coverage detected