mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
chore: ran linting
This commit is contained in:
parent
a5bf3af4f8
commit
8c9440998a
5 changed files with 13 additions and 21 deletions
|
|
@ -133,21 +133,19 @@ def _migrate_shared_memories(conn: sa.engine.Connection) -> None:
|
|||
migrated = 0
|
||||
for space_id, space_rows in by_space.items():
|
||||
existing = conn.execute(
|
||||
sa.text(
|
||||
"SELECT shared_memory_md FROM searchspaces WHERE id = :sid"
|
||||
),
|
||||
sa.text("SELECT shared_memory_md FROM searchspaces WHERE id = :sid"),
|
||||
{"sid": space_id},
|
||||
).scalar()
|
||||
|
||||
if existing and existing.strip():
|
||||
logger.info("Search space %s already has shared_memory_md, skipping.", space_id)
|
||||
logger.info(
|
||||
"Search space %s already has shared_memory_md, skipping.", space_id
|
||||
)
|
||||
continue
|
||||
|
||||
markdown = _build_markdown(space_rows)
|
||||
conn.execute(
|
||||
sa.text(
|
||||
"UPDATE searchspaces SET shared_memory_md = :md WHERE id = :sid"
|
||||
),
|
||||
sa.text("UPDATE searchspaces SET shared_memory_md = :md WHERE id = :sid"),
|
||||
{"md": markdown, "sid": space_id},
|
||||
)
|
||||
migrated += 1
|
||||
|
|
|
|||
|
|
@ -130,7 +130,9 @@ async def extract_and_save_memory(
|
|||
return
|
||||
|
||||
old_memory = user.memory_md
|
||||
first_name = user.display_name.split()[0] if user.display_name else "The user"
|
||||
first_name = (
|
||||
user.display_name.split()[0] if user.display_name else "The user"
|
||||
)
|
||||
prompt = _MEMORY_EXTRACT_PROMPT.format(
|
||||
current_memory=old_memory or "(empty)",
|
||||
user_message=user_message,
|
||||
|
|
|
|||
|
|
@ -37,9 +37,7 @@ _SECTION_HEADING_RE = re.compile(r"^##\s+(.+)$", re.MULTILINE)
|
|||
_HEADING_NORMALIZE_RE = re.compile(r"\s+")
|
||||
|
||||
_MARKER_RE = re.compile(r"\[(fact|pref|instr)\]")
|
||||
_BULLET_FORMAT_RE = re.compile(
|
||||
r"^- \(\d{4}-\d{2}-\d{2}\) \[(fact|pref|instr)\] .+$"
|
||||
)
|
||||
_BULLET_FORMAT_RE = re.compile(r"^- \(\d{4}-\d{2}-\d{2}\) \[(fact|pref|instr)\] .+$")
|
||||
_PERSONAL_ONLY_MARKERS = {"pref", "instr"}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -77,19 +77,13 @@ def test_validate_memory_scope_allows_all_markers_in_user_scope() -> None:
|
|||
|
||||
|
||||
def test_validate_memory_scope_allows_any_heading_in_team() -> None:
|
||||
content = (
|
||||
"## Architecture\n"
|
||||
"- (2026-04-10) [fact] Uses PostgreSQL for persistence\n"
|
||||
)
|
||||
content = "## Architecture\n- (2026-04-10) [fact] Uses PostgreSQL for persistence\n"
|
||||
result = _validate_memory_scope(content, "team")
|
||||
assert result is None
|
||||
|
||||
|
||||
def test_validate_memory_scope_allows_any_heading_in_user() -> None:
|
||||
content = (
|
||||
"## My Projects\n"
|
||||
"- (2026-04-10) [fact] Working on SurfSense\n"
|
||||
)
|
||||
content = "## My Projects\n- (2026-04-10) [fact] Working on SurfSense\n"
|
||||
result = _validate_memory_scope(content, "user")
|
||||
assert result is None
|
||||
|
||||
|
|
|
|||
|
|
@ -219,8 +219,8 @@ export function MemoryContent() {
|
|||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span className={`text-xs shrink-0 ${getCounterColor()}`}>
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span className={`text-xs shrink-0 ${getCounterColor()}`}>
|
||||
{charCount.toLocaleString()} / {MEMORY_HARD_LIMIT.toLocaleString()}
|
||||
<span className="hidden sm:inline"> characters</span>
|
||||
<span className="sm:hidden"> chars</span>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue