-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from Chanzhaoyu/dev
chore: version 2.2.0
- Loading branch information
Showing
26 changed files
with
548 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
## v2.2.0 | ||
|
||
`2023-02-14` | ||
### Feature | ||
- 会话和上下文本地储存 | ||
- 侧边栏本地储存 | ||
|
||
## v2.1.0 | ||
|
||
`2023-02-14` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import type { GenericAbortSignal } from 'axios' | ||
import { post } from '@/utils/request' | ||
|
||
export const controller = new AbortController() | ||
|
||
export function fetchChatAPI<T = any>( | ||
prompt: string, | ||
options?: { conversationId?: string; parentMessageId?: string }, | ||
signal?: GenericAbortSignal, | ||
) { | ||
return post<T>({ | ||
url: '/chat', | ||
data: { prompt, options }, | ||
}) | ||
} | ||
|
||
export function clearConversations<T = any>() { | ||
return post<T>({ | ||
url: '/clear', | ||
signal, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useHistoryStore } from '@/store' | ||
|
||
export function useChat() { | ||
const historyStore = useHistoryStore() | ||
|
||
function addChat( | ||
message: string, | ||
args?: { reversal?: boolean; error?: boolean; options?: Chat.ChatOptions }, | ||
uuid?: number | null, | ||
) { | ||
historyStore.addChat( | ||
{ | ||
dateTime: new Date().toLocaleString(), | ||
message, | ||
reversal: args?.reversal ?? false, | ||
error: args?.error ?? false, | ||
options: args?.options ?? undefined, | ||
}, | ||
uuid, | ||
) | ||
} | ||
|
||
function clearChat() { | ||
historyStore.clearChat() | ||
} | ||
|
||
return { addChat, clearChat } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.