fix(local-llm): use resolved model for auto titles
This commit is contained in:
parent
bf2c285e41
commit
604ce97e0d
@ -88,14 +88,14 @@ export function ConversationView({
|
|||||||
if (next && onConversationUpdated) onConversationUpdated(next);
|
if (next && onConversationUpdated) onConversationUpdated(next);
|
||||||
};
|
};
|
||||||
|
|
||||||
const maybeAutoTitle = async (firstUserMessage: string) => {
|
const maybeAutoTitle = async (firstUserMessage: string, model: string) => {
|
||||||
if (title !== 'New Conversation' || !firstUserMessage.trim()) return;
|
if (title !== 'New Conversation' || !firstUserMessage.trim()) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/ollama/title', {
|
const res = await fetch('/api/ollama/title', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ message: firstUserMessage, model: selectedModel }),
|
body: JSON.stringify({ message: firstUserMessage, model }),
|
||||||
});
|
});
|
||||||
const data = (await res.json()) as { title?: string };
|
const data = (await res.json()) as { title?: string };
|
||||||
const nextTitle = (data.title || 'New Conversation').trim();
|
const nextTitle = (data.title || 'New Conversation').trim();
|
||||||
@ -244,7 +244,7 @@ export function ConversationView({
|
|||||||
|
|
||||||
const userCount = nextMessages.filter(m => m.role === 'user').length;
|
const userCount = nextMessages.filter(m => m.role === 'user').length;
|
||||||
if (userCount === 1) {
|
if (userCount === 1) {
|
||||||
await maybeAutoTitle(text);
|
await maybeAutoTitle(text, routedModel);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!controller.signal.aborted) {
|
if (!controller.signal.aborted) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user