You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. First, if the user hasn't verified their setup, call hackmd_get_me to check credentials
27
-
2. Ask about: conference name, team path, session data (user uploads JSON)
26
+
2. Ask about conference name and preferences. **Only** if there is no \`<session_data>\` block in your instructions for this request, ask them to upload session JSON in the UI. If \`<session_data>\` is present, session data is already loaded — do not ask for upload or paste.
28
27
3. Use jq_query to analyze the session data shape and summarize it for the user
29
28
4. If user mentions a reference note, fetch it with hackmd_get_note
30
29
5. Use generate_pages to create all pages, show preview
31
30
6. User confirms → they click "Create Notes" button in the UI
32
31
32
+
## When session data is already provided
33
+
If this request includes an \`<session_data>\` section below, the user has already uploaded sessions in the app. **Do not** ask them to upload or paste JSON again. Start with jq_query or answer their question using that data.
34
+
33
35
## Important Notes
34
36
- Always use jq_query first to understand data shape before generating pages — this saves tokens
35
37
- When showing previews, show the homepage and 1-2 sample session pages
@@ -55,13 +57,15 @@ But you should use jq_query to discover the actual shape of uploaded data and ad
55
57
56
58
exportasyncfunctionPOST(req: Request){
57
59
constbody=awaitreq.json()
58
-
const{ messages, config }=bodyas{
59
-
messages: ModelMessage[]
60
+
const{ messages, config, sessionDataJson}=bodyas{
61
+
messages: UIMessage[]
60
62
config: {
61
63
apiKey: string
62
64
apiEndpoint: string
63
65
teamPath: string
64
66
}
67
+
/** Raw session JSON; sent out-of-band so the chat UI does not embed huge payloads. */
68
+
sessionDataJson?: string
65
69
}
66
70
67
71
if(!config?.apiKey){
@@ -85,16 +89,29 @@ export async function POST(req: Request) {
system+=`\n\n## Uploaded session data (${n} sessions) — attached by the app on every request while a file is loaded\n**You must not ask the user to upload or paste session JSON** — it is already in \`<session_data>\`. Use jq_query on this JSON. Use generate_pages with sessionsJson from this data when generating pages.\n\n<session_data>\n${sessionDataJson}\n</session_data>`
101
+
}catch{
102
+
system+=`\n\n## Uploaded session data — attached by the app; do not ask for upload/paste\n<session_data>\n${sessionDataJson}\n</session_data>`
0 commit comments