mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-30 19:36:24 +00:00
Update notification-settings.tsx
This commit is contained in:
@@ -598,13 +598,20 @@ export function NotificationSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fetchOllamaModels = useCallback(async (url: string) => {
|
const fetchOllamaModels = useCallback(async (url: string) => {
|
||||||
if (!url) return
|
console.log("[v0] fetchOllamaModels called with URL:", url)
|
||||||
|
if (!url) {
|
||||||
|
console.log("[v0] fetchOllamaModels: URL is empty, returning")
|
||||||
|
return
|
||||||
|
}
|
||||||
setLoadingOllamaModels(true)
|
setLoadingOllamaModels(true)
|
||||||
|
console.log("[v0] fetchOllamaModels: Starting fetch...")
|
||||||
try {
|
try {
|
||||||
const data = await fetchApi<{ success: boolean; models: string[]; message: string }>("/api/notifications/ollama-models", {
|
const data = await fetchApi<{ success: boolean; models: string[]; message: string }>("/api/notifications/ollama-models", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ ollama_url: url }),
|
body: JSON.stringify({ ollama_url: url }),
|
||||||
})
|
})
|
||||||
|
console.log("[v0] fetchOllamaModels: Response:", data)
|
||||||
if (data.success && data.models && data.models.length > 0) {
|
if (data.success && data.models && data.models.length > 0) {
|
||||||
setOllamaModels(data.models)
|
setOllamaModels(data.models)
|
||||||
// Auto-select first model if current selection is empty or not in the list
|
// Auto-select first model if current selection is empty or not in the list
|
||||||
@@ -1437,8 +1444,11 @@ export function NotificationSettings() {
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
className="h-9 px-3 shrink-0"
|
className="h-9 px-3 shrink-0"
|
||||||
onClick={() => fetchOllamaModels(config.ai_ollama_url)}
|
onClick={() => {
|
||||||
disabled={!editMode || loadingOllamaModels || !config.ai_ollama_url}
|
console.log("[v0] Load button clicked, URL:", config.ai_ollama_url)
|
||||||
|
fetchOllamaModels(config.ai_ollama_url)
|
||||||
|
}}
|
||||||
|
disabled={loadingOllamaModels || !config.ai_ollama_url}
|
||||||
>
|
>
|
||||||
{loadingOllamaModels ? (
|
{loadingOllamaModels ? (
|
||||||
<Loader2 className="h-4 w-4 animate-spin" />
|
<Loader2 className="h-4 w-4 animate-spin" />
|
||||||
@@ -1745,7 +1755,7 @@ export function NotificationSettings() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="ml-8 space-y-1 text-muted-foreground text-xs">
|
<div className="ml-8 space-y-1 text-muted-foreground text-xs">
|
||||||
<p>After creating the bot, BotFather will give you a token like:</p>
|
<p>After creating the bot, BotFather will give you a token like:</p>
|
||||||
<code className="block bg-muted px-2 py-1 rounded text-[11px] mt-1">7595377878:AAGExxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>
|
<code className="block bg-muted px-2 py-1 rounded text-[11px] mt-1">{"<bot_id>:<bot_secret>"}</code>
|
||||||
<p className="mt-1">Copy this token and paste it in the <strong>Bot Token</strong> field.</p>
|
<p className="mt-1">Copy this token and paste it in the <strong>Bot Token</strong> field.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user