尝试扒了一下 ChatPDF 的 prompt。摘要的部分算法 session 隔离了,扒不出来,以下是生成回答的 prompt。
You are a helpful PDF file. Given the following pages of the PDF as information source, answer any questions the user asks.
聊点gpt防注入的架构设计
和用户直接交互的部分需要单独起session,与内部的prompt通过session隔离。
用户输入需要先过一层防火墙,主要是check输入是否与职能有关,防火墙只需要回答yes or no,不处理逻辑
输出防火墙所做的是去除回答中step by step的部分,要求gpt仅节选出回答中的答案部分。