mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 21:25:45 +08:00
feat(core): move context docs to user prompt (#10162)
Fix issue [BS-2522](https://linear.app/affine-design/issue/BS-2522). ### Why make this change? If the user data contains illegal content, carrying the user data in the system prompt will run the risk of having the account banned. ### What Changed? - Move the `Context Documents` to the user prompt. - Add `withPrompt` in `QueryChatHistoriesInput` options. - Get chat histories without prompt messages. - Omit document context when saving messages to the `aiSessionMessage` db.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type {
|
||||
ChatHistoryOrder,
|
||||
CopilotContextDoc,
|
||||
CopilotContextFile,
|
||||
getCopilotHistoriesQuery,
|
||||
@@ -312,9 +313,10 @@ declare global {
|
||||
chats: (
|
||||
workspaceId: string,
|
||||
docId?: string,
|
||||
options?: RequestOptions<
|
||||
typeof getCopilotHistoriesQuery
|
||||
>['variables']['options']
|
||||
options?: {
|
||||
sessionId?: string;
|
||||
messageOrder?: ChatHistoryOrder;
|
||||
}
|
||||
) => Promise<AIHistory[] | undefined>;
|
||||
cleanup: (
|
||||
workspaceId: string,
|
||||
|
||||
@@ -125,7 +125,7 @@ export class ChatPanel extends WithDisposable(ShadowlessElement) {
|
||||
const currentRequest = ++this._updateHistoryCounter;
|
||||
|
||||
const [histories, actions] = await Promise.all([
|
||||
AIProvider.histories?.chats(doc.workspace.id, doc.id, { fork: false }),
|
||||
AIProvider.histories?.chats(doc.workspace.id, doc.id),
|
||||
AIProvider.histories?.actions(doc.workspace.id, doc.id),
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user