mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 16:44:33 +00:00
fix: derive citations chat type via session parser
This commit is contained in:
committed by
Vignesh
parent
d0b98c75e5
commit
edd6289f26
@@ -5,6 +5,7 @@ import type { MemoryCitationsMode } from "../../config/types.memory.js";
|
||||
import { resolveMemoryBackendConfig } from "../../memory/backend-config.js";
|
||||
import { getMemorySearchManager } from "../../memory/index.js";
|
||||
import type { MemorySearchResult } from "../../memory/types.js";
|
||||
import { parseAgentSessionKey } from "../../routing/session-key.js";
|
||||
import { resolveSessionAgentId } from "../agent-scope.js";
|
||||
import { resolveMemorySearchConfig } from "../memory-search.js";
|
||||
import type { AnyAgentTool } from "./common.js";
|
||||
@@ -195,14 +196,19 @@ function shouldIncludeCitations(params: {
|
||||
}
|
||||
|
||||
function deriveChatTypeFromSessionKey(sessionKey?: string): "direct" | "group" | "channel" {
|
||||
if (!sessionKey) {
|
||||
const parsed = parseAgentSessionKey(sessionKey);
|
||||
if (!parsed?.rest) {
|
||||
return "direct";
|
||||
}
|
||||
if (sessionKey.includes(":group:")) {
|
||||
return "group";
|
||||
}
|
||||
if (sessionKey.includes(":channel:")) {
|
||||
const tokens = parsed.rest
|
||||
.toLowerCase()
|
||||
.split(":")
|
||||
.filter(Boolean);
|
||||
if (tokens.includes("channel")) {
|
||||
return "channel";
|
||||
}
|
||||
if (tokens.includes("group")) {
|
||||
return "group";
|
||||
}
|
||||
return "direct";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user