fix: fetch threads and messages without limiting (#4304)
* fix: threads and messages are cutoff * fix: threads sorting * chore: bump cortex latest release and app version
This commit is contained in:
parent
1acbb33677
commit
4e43f9798d
@ -40,7 +40,7 @@ export default class CortexConversationalExtension extends ConversationalExtensi
|
||||
async listThreads(): Promise<Thread[]> {
|
||||
return this.queue.add(() =>
|
||||
ky
|
||||
.get(`${API_URL}/v1/threads`)
|
||||
.get(`${API_URL}/v1/threads?limit=-1`)
|
||||
.json<ThreadList>()
|
||||
.then((e) => e.data)
|
||||
) as Promise<Thread[]>
|
||||
@ -133,7 +133,7 @@ export default class CortexConversationalExtension extends ConversationalExtensi
|
||||
async listMessages(threadId: string): Promise<ThreadMessage[]> {
|
||||
return this.queue.add(() =>
|
||||
ky
|
||||
.get(`${API_URL}/v1/threads/${threadId}/messages?order=asc`)
|
||||
.get(`${API_URL}/v1/threads/${threadId}/messages?order=asc&limit=-1`)
|
||||
.json<MessageList>()
|
||||
.then((e) => e.data)
|
||||
) as Promise<ThreadMessage[]>
|
||||
@ -147,7 +147,7 @@ export default class CortexConversationalExtension extends ConversationalExtensi
|
||||
*/
|
||||
async getThreadAssistant(threadId: string): Promise<ThreadAssistantInfo> {
|
||||
return this.queue.add(() =>
|
||||
ky.get(`${API_URL}/v1/assistants/${threadId}`).json<ThreadAssistantInfo>()
|
||||
ky.get(`${API_URL}/v1/assistants/${threadId}?limit=-1`).json<ThreadAssistantInfo>()
|
||||
) as Promise<ThreadAssistantInfo>
|
||||
}
|
||||
/**
|
||||
|
||||
@ -1 +1 @@
|
||||
1.0.5-rc2
|
||||
1.0.5
|
||||
|
||||
@ -53,7 +53,7 @@ export class CortexAPI implements ICortexAPI {
|
||||
*/
|
||||
getModels(): Promise<Model[]> {
|
||||
return this.queue
|
||||
.add(() => ky.get(`${API_URL}/v1/models`).json<ModelList>())
|
||||
.add(() => ky.get(`${API_URL}/v1/models?limit=-1`).json<ModelList>())
|
||||
.then((e) =>
|
||||
typeof e === 'object' ? e.data.map((e) => this.transformModel(e)) : []
|
||||
)
|
||||
|
||||
@ -244,6 +244,7 @@ export default function ModelHandler() {
|
||||
const metadata = {
|
||||
...thread.metadata,
|
||||
...(messageContent && { lastMessage: messageContent }),
|
||||
updated_at: Date.now(),
|
||||
}
|
||||
|
||||
updateThread({
|
||||
|
||||
@ -153,6 +153,7 @@ export const useCreateNewThread = () => {
|
||||
updated: createdAt,
|
||||
metadata: {
|
||||
title: 'New Thread',
|
||||
updated_at: Date.now(),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,12 @@ const useThreads = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const getThreads = async () => {
|
||||
const localThreads = await getLocalThreads()
|
||||
const localThreads = (await getLocalThreads()).sort((a, b) => {
|
||||
return ((a.metadata?.updated_at as number) ?? 0) >
|
||||
((b.metadata?.updated_at as number) ?? 0)
|
||||
? -1
|
||||
: 1
|
||||
})
|
||||
const localThreadStates: Record<string, ThreadState> = {}
|
||||
const threadModelParams: Record<string, ModelParams> = {}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@janhq/web",
|
||||
"version": "0.5.11",
|
||||
"version": "0.5.12",
|
||||
"private": true,
|
||||
"homepage": "./",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user