Atlas: opening message, isInit flag, strip trigger from history

- Add opening message instruction to atlas prompt
- Handle isInit flag in atlasChat() to not store the greeting trigger
  as a user turn in conversation history
- Update server.ts to pass is_init through to atlasChat()

Made-with: Cursor
This commit is contained in:
2026-03-02 16:55:16 -08:00
parent ecd207108c
commit e8fdbff9f4
3 changed files with 25 additions and 3 deletions

View File

@@ -225,11 +225,13 @@ app.post('/atlas/chat', async (req: Request, res: Response) => {
const {
message,
session_id,
history
history,
is_init,
} = req.body as {
message?: string;
session_id?: string;
history?: LLMMessage[];
is_init?: boolean;
};
if (!message) { res.status(400).json({ error: '"message" is required' }); return; }
@@ -238,7 +240,10 @@ app.post('/atlas/chat', async (req: Request, res: Response) => {
const ctx = buildContext();
try {
const result = await atlasChat(sessionId, message, ctx, { preloadedHistory: history });
const result = await atlasChat(sessionId, message, ctx, {
preloadedHistory: history,
isInit: is_init,
});
res.json(result);
} catch (err) {
res.status(500).json({ error: err instanceof Error ? err.message : String(err) });