Skip to content

Commit 48ffe3c

Browse files
authored
Merge pull request #694 from n4ze3m/next
v1.5.27
2 parents 7670ba1 + 1690298 commit 48ffe3c

File tree

10 files changed

+216
-142
lines changed

10 files changed

+216
-142
lines changed

src/components/Option/Sidebar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
} from "@/db/dexie/helpers"
4545
import { UploadedFile } from "@/db/dexie/types"
4646
import { isDatabaseClosedError } from "@/utils/ff-error"
47+
import { updatePageTitle } from "@/utils/update-page-title"
4748

4849
type Props = {
4950
onClose: () => void
@@ -203,6 +204,7 @@ export const Sidebar = ({
203204
})
204205
if (historyId === history_id) {
205206
clearChat()
207+
updatePageTitle()
206208
}
207209
}
208210
})
@@ -407,6 +409,7 @@ export const Sidebar = ({
407409
const session = await getSessionFiles(chat.id)
408410
setContext(session)
409411
}
412+
updatePageTitle(chat.title)
410413
navigate("/")
411414
onClose()
412415
}}>

src/db/dexie/models.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,30 @@ export const dynamicFetchOllama2 = async ({
487487
providerId: string
488488
customHeaders?: { key: string; value: string }[]
489489
}) => {
490+
if (baseUrl.includes("ollama.com")) {
491+
// ollama.com is turbo pro something it only have 2 models
492+
// we are currenly hardcoding it i don't why
493+
const models = [
494+
{
495+
name: "gpt-oss:20b",
496+
id: "gpt-oss:20b"
497+
},
498+
{
499+
name: "gpt-oss:120b",
500+
id: "gpt-oss:120b"
501+
}
502+
]
503+
504+
return models.map((e) => {
505+
return {
506+
name: e?.name || e?.id,
507+
id: `${e?.id}_ollama2_${providerId}`,
508+
provider: providerId,
509+
lookup: `${e?.id}_${providerId}`,
510+
provider_id: providerId
511+
}
512+
})
513+
}
490514
const models = await getAllOpenAIModels({ baseUrl, customHeaders })
491515
const ollama2Models = models.map((e) => {
492516
return {

src/db/models.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ export const dynamicFetchOllama2 = async ({
447447
providerId: string
448448
customHeaders?: { key: string; value: string }[]
449449
}) => {
450+
451+
450452
const models = await getAllOpenAIModels({ baseUrl, customHeaders })
451453
const ollama2Models = models.map((e) => {
452454
return {

src/hooks/chat-helper/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { ChatDocuments } from "@/models/ChatTypes"
1111
import { generateTitle } from "@/services/title"
1212
import { ChatHistory } from "@/store/option"
13+
import { updatePageTitle } from "@/utils/update-page-title"
1314

1415
export const saveMessageOnError = async ({
1516
e,
@@ -107,6 +108,7 @@ export const saveMessageOnError = async ({
107108
} else {
108109
const title = await generateTitle(selectedModel, userMessage, userMessage)
109110
const newHistoryId = await saveHistory(title, false, message_source)
111+
updatePageTitle(title)
110112
if (!isRegenerating) {
111113
await saveMessage({
112114
history_id: newHistoryId.id,
@@ -242,6 +244,7 @@ export const saveMessageOnSuccess = async ({
242244
return historyId
243245
} else {
244246
const title = await generateTitle(selectedModel, message, message)
247+
updatePageTitle(title)
245248
const newHistoryId = await saveHistory(title, false, message_source)
246249

247250
await saveMessage(

src/hooks/useMessage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import {
4646
createSaveMessageOnError,
4747
createSaveMessageOnSuccess
4848
} from "./utils/messageHelpers"
49+
import { updatePageTitle } from "@/utils/update-page-title"
4950

5051
export const useMessage = () => {
5152
const {
@@ -124,6 +125,7 @@ export const useMessage = () => {
124125
setIsLoading(false)
125126
setIsProcessing(false)
126127
setStreaming(false)
128+
updatePageTitle()
127129
currentChatModelSettings.reset()
128130
if (defaultInternetSearchOn) {
129131
setWebSearch(true)

src/hooks/useMessageOption.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { tabChatMode } from "./chat-modes/tabChatMode"
3030
import { documentChatMode } from "./chat-modes/documentChatMode"
3131
import { generateID } from "@/db/dexie/helpers"
3232
import { UploadedFile } from "@/db/dexie/types"
33+
import { updatePageTitle } from "@/utils/update-page-title"
3334

3435
export const useMessageOption = () => {
3536
const {
@@ -163,7 +164,7 @@ export const useMessageOption = () => {
163164
setIsProcessing(false)
164165
setStreaming(false)
165166
setContextFiles([])
166-
console.log("clearChat", contextFiles)
167+
updatePageTitle()
167168
currentChatModelSettings.reset()
168169
// textareaRef?.current?.focus()
169170
if (defaultInternetSearchOn) {

0 commit comments

Comments
 (0)