|
1390 | 1390 | models: { ...CUSTOM_MODELS } |
1391 | 1391 | }; |
1392 | 1392 |
|
1393 | | -// Helper function to get model configuration |
1394 | | -function getModelConfig(modelName) { |
1395 | | - return MODEL_CONFIG.models[modelName] || { |
1396 | | - baseModel: true, |
1397 | | - type: "chat", |
1398 | | - jsonMode: false, |
1399 | | - censored: true, |
1400 | | - systemMessage: `You are a helpful AI assistant based on ${modelName}.`, |
1401 | | - needsInstruction: true |
1402 | | - }; |
1403 | | -} |
1404 | | - |
1405 | 1393 | // Build messages function with improved configuration handling |
1406 | 1394 | async function buildMessages(modelName, userMessage) { |
1407 | 1395 | const messages = []; |
|
1938 | 1926 | }; |
1939 | 1927 | } |
1940 | 1928 |
|
1941 | | - |
1942 | | -async function handleModelChange(e) { |
1943 | | - const selectedModel = e.target.value; |
1944 | | - localStorage.removeItem(`${selectedModel}Avatar`); |
1945 | | - fadeOutAndClear(); |
1946 | | - conversationHistory = []; |
1947 | | - localStorage.removeItem("conversationHistory"); |
1948 | | - |
1949 | | - if (window.speechSynthesis) { |
1950 | | - window.speechSynthesis.cancel(); |
1951 | | - } |
1952 | | - stopTTS(); |
1953 | | - |
1954 | | - // Add this line: |
1955 | | - updateScreensaverForModel(selectedModel); |
1956 | | -} |
1957 | | - |
1958 | | - |
1959 | 1929 | function extractPromptPart(url) { |
1960 | 1930 | const match = url.match(/\/prompt\/([^?]+)/); |
1961 | 1931 | return match ? match[1] : null; |
|
2425 | 2395 | } |
2426 | 2396 |
|
2427 | 2397 |
|
2428 | | - function createMessage(type, content) { |
2429 | | - const div = document.createElement("div"); |
2430 | | - div.className = `message ${type}-message`; |
2431 | | - div.style.opacity = "0"; |
| 2398 | + function getUnityAvatar() { |
| 2399 | + return "https://image.pollinations.ai/prompt/close_portrait_black_hair_emo_goth_female_age_25_detailed_face?width=512&height=512&seed=9999&enhance=true&quality=high&nologo=true&model=flux"; |
| 2400 | +} |
2432 | 2401 |
|
| 2402 | + // The rest of your code remains the same, now the call to getUnityAvatar() works: |
| 2403 | + function createMessage(type, content) { |
| 2404 | + const div = document.createElement("div"); |
| 2405 | + div.className = `message ${type}-message`; |
| 2406 | + div.style.opacity = "0"; |
2433 | 2407 |
|
2434 | | - if (type === "ai") { |
2435 | | - const avatar = document.createElement("div"); |
2436 | | - avatar.className = "message-avatar"; |
2437 | | - avatar.innerHTML = `<img src="${getUnityAvatar()}" alt="Unity">`; |
2438 | | - div.appendChild(avatar); |
2439 | | - } |
| 2408 | + if (type === "ai") { |
| 2409 | + const avatar = document.createElement("div"); |
| 2410 | + avatar.className = "message-avatar"; |
| 2411 | + avatar.innerHTML = `<img src="${getUnityAvatar()}" alt="Unity">`; |
| 2412 | + div.appendChild(avatar); |
| 2413 | + } |
2440 | 2414 |
|
2441 | 2415 |
|
2442 | 2416 | const contentDiv = document.createElement("div"); |
|
2823 | 2797 | stopScreensaver(); |
2824 | 2798 | } |
2825 | 2799 | }); |
2826 | | - function handleCodePanelToggles(view) { |
2827 | | - if (screensaverActive && view === 'code') { |
2828 | | - stopScreensaver(); |
2829 | | - localStorage.setItem('screensaver-resume', 'true'); |
2830 | | - } |
2831 | | -} |
| 2800 | + |
2832 | 2801 |
|
2833 | 2802 | // Double-click to exit |
2834 | 2803 | container.addEventListener('dblclick', () => { |
|
2837 | 2806 | } |
2838 | 2807 | }); |
2839 | 2808 | } |
2840 | | - |
| 2809 | + function handleCodePanelToggles(view) { |
| 2810 | + if (screensaverActive && view === 'code') { |
| 2811 | + stopScreensaver(); |
| 2812 | + localStorage.setItem('screensaver-resume', 'true'); |
| 2813 | + } |
| 2814 | +} |
2841 | 2815 | async function copyImageToClipboard(imgId) { |
2842 | 2816 | try { |
2843 | 2817 | const imgElement = document.getElementById(imgId); |
|
0 commit comments