forked from Blendman974/faceclaw
Hermes integration survives restarts, fix error hadling, increase turn length limit
This commit is contained in:
1 parent
825559aa82
commit
de653f0fbb
6 files changed
+100
-9
No files matched your search
@@ -22,6 +22,8 @@ export type AssistantSessionHistory = {
|
||||
transcript: AssistantTranscriptEntry[];
|
||||
/** Model identity for safe replay after Auto resolves differently on restart. */
|
||||
engine?: string;
|
||||
/** The Hermes server-side session for this conversation (Hermes keeps the history). */
|
||||
hermesSessionId?: string;
|
||||
};
|
||||
|
||||
/** Which engine answers utterances, plus what it needs to do so. */
|
||||
@@ -48,14 +50,18 @@ export class AssistantSession {
|
||||
// API-safe tool name -> canonical registry name. Provider APIs restrict tool
|
||||
// names, so dotted registry names are sanitized and mapped back on calls.
|
||||
private readonly toolNameMap = new Map<string, string>();
|
||||
// The Hermes server-side session for this conversation (Hermes keeps the history).
|
||||
private readonly hermesSessionId = `faceclaw-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
// Saved with the history: Faceclaw only sends Hermes the latest message, so a
|
||||
// restored conversation must keep addressing the same server-side session.
|
||||
private readonly hermesSessionId: string;
|
||||
|
||||
constructor(
|
||||
private config: AssistantBackendConfig,
|
||||
private readonly registry: ToolRegistry = toolRegistry,
|
||||
history?: AssistantSessionHistory,
|
||||
) {
|
||||
this.hermesSessionId = typeof history?.hermesSessionId === "string" && history.hermesSessionId
|
||||
? history.hermesSessionId
|
||||
: `faceclaw-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
if (history) {
|
||||
this.messages.push(...history.messages);
|
||||
this.transcript.push(...history.transcript);
|
||||
@@ -75,7 +81,7 @@ export class AssistantSession {
|
||||
}
|
||||
|
||||
history(): AssistantSessionHistory {
|
||||
return { messages: this.messages, transcript: this.transcript, engine: this.engine() };
|
||||
return { messages: this.messages, transcript: this.transcript, engine: this.engine(), hermesSessionId: this.hermesSessionId };
|
||||
}
|
||||
|
||||
configure(config: AssistantBackendConfig): void {
|
||||
|
||||
Reference in new issue
Block a user