mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +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:
@@ -151,6 +151,9 @@ class QueryChatHistoriesInput implements Partial<ListHistoriesOptions> {
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
sessionId: string | undefined;
|
||||
|
||||
@Field(() => Boolean, { nullable: true })
|
||||
withPrompt: boolean | undefined;
|
||||
}
|
||||
|
||||
// ================== Return Types ==================
|
||||
@@ -346,8 +349,7 @@ export class CopilotResolver {
|
||||
user.id,
|
||||
workspaceId,
|
||||
docId,
|
||||
options,
|
||||
true
|
||||
options
|
||||
);
|
||||
|
||||
return histories.map(h => ({
|
||||
|
||||
Reference in New Issue
Block a user