mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
feat(core): cite source documents in the AI answer (#9863)
Support issue [BS-2424](https://linear.app/affine-design/issue/BS-2424). ### What changed? - Add relevant document prompt templates. - Add citation rules in system prompts. - Change message `params` type to `Record<string, any>` - Add unit test. <div class='graphite__hidden'> <div>🎥 Video uploaded on Graphite:</div> <a href="https://app.graphite.dev/media/video/sJGviKxfE3Ap685cl5bj/ec24e664-039e-4fab-bd26-b3312f011daf.mov"> <img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/sJGviKxfE3Ap685cl5bj/ec24e664-039e-4fab-bd26-b3312f011daf.mov"> </a> </div> <video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/ec24e664-039e-4fab-bd26-b3312f011daf.mov">录屏2025-01-23 10.40.38.mov</video>
This commit is contained in:
@@ -120,7 +120,7 @@ export class CitationParser {
|
||||
}
|
||||
|
||||
public end() {
|
||||
return this.flush() + this.getFootnotes();
|
||||
return this.flush() + '\n' + this.getFootnotes();
|
||||
}
|
||||
|
||||
private flush() {
|
||||
@@ -135,7 +135,7 @@ export class CitationParser {
|
||||
citation
|
||||
)}"}`;
|
||||
});
|
||||
return '\n\n' + footnotes.join('\n\n');
|
||||
return footnotes.join('\n');
|
||||
}
|
||||
|
||||
private getTokenContent() {
|
||||
|
||||
Reference in New Issue
Block a user