removed the voice agent
This commit is contained in:
@@ -0,0 +1,114 @@
|
|||||||
|
import io
|
||||||
|
|
||||||
|
p = r"C:\Users\HP\Desktop\Dev\New UI CRM\frontend\src\index.css"
|
||||||
|
s = io.open(p, encoding='utf-8').read()
|
||||||
|
|
||||||
|
# ── 1. Remove the global @layer base block. ──────────────────────────────────
|
||||||
|
# Tailwind's own `@import "tailwindcss"` already includes Preflight (the
|
||||||
|
# box-sizing:border-box reset), so nothing is lost. The border/bg/font rules
|
||||||
|
# move into a scoped selector below instead of applying app-wide.
|
||||||
|
old_layer = """@custom-variant dark (&:is(.dark *));
|
||||||
|
@layer base {
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
* {
|
||||||
|
@apply border-border outline-ring/50;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
@apply bg-background text-foreground;
|
||||||
|
}
|
||||||
|
html {
|
||||||
|
@apply font-sans;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
assert old_layer in s, "layer block not found"
|
||||||
|
s = s.replace(old_layer, "@custom-variant dark (&:is(.dark *));\n")
|
||||||
|
|
||||||
|
# ── 2. Restore WeLe's original --border (init silently overwrote it). ────────
|
||||||
|
old_border = " --border: oklch(0.922 0 0);\n --border-strong: rgba(0, 0, 0, 0.14);"
|
||||||
|
new_border = " --border: rgba(0, 0, 0, 0.08);\n --border-strong: rgba(0, 0, 0, 0.14);"
|
||||||
|
assert old_border in s, "border line not found"
|
||||||
|
s = s.replace(old_border, new_border)
|
||||||
|
|
||||||
|
# ── 3. Pull the shadcn/assistant-ui LIGHT-mode tokens out of global :root. ───
|
||||||
|
block_start = " --background: oklch(1 0 0);"
|
||||||
|
block_end = " --sidebar-ring: oklch(0.708 0 0);\n}"
|
||||||
|
i = s.index(block_start)
|
||||||
|
j = s.index(block_end) + len(block_end)
|
||||||
|
removed = s[i:j]
|
||||||
|
assert removed.startswith(block_start) and removed.rstrip().endswith("}")
|
||||||
|
inner_vars = removed[:removed.rindex("}")].rstrip("\n")
|
||||||
|
s = s[:i].rstrip() + "\n}\n" + s[j:]
|
||||||
|
|
||||||
|
# ── 4. Strip the DARK-mode block too (scoped version added below; nothing in
|
||||||
|
# the CRM currently toggles a `.dark` class, so a global one is inert
|
||||||
|
# but pointless clutter — and would collide the moment something did). ──
|
||||||
|
dark_start = "\n.dark {\n"
|
||||||
|
dark_end_marker = " --sidebar-ring: oklch(0.556 0 0);\n}\n"
|
||||||
|
di = s.index(dark_start)
|
||||||
|
dj = s.index(dark_end_marker, di) + len(dark_end_marker)
|
||||||
|
dark_block = s[di:dj]
|
||||||
|
dark_inner = dark_block[len(dark_start):dark_block.rindex("}")].rstrip("\n")
|
||||||
|
s = s[:di] + "\n" + s[dj:]
|
||||||
|
|
||||||
|
# ── 5. In @theme inline: drop the --radius-{sm,md,lg,xl} lines. ──────────────
|
||||||
|
# These are Tailwind's own canonical theme keys. The moment @theme declares
|
||||||
|
# them, Tailwind stops using its built-in stock radius scale for .rounded-md
|
||||||
|
# etc and ALWAYS reads var(--radius-md) instead — everywhere in the app, not
|
||||||
|
# just inside the new assistant-ui components. WeLe's CallsPage.jsx already
|
||||||
|
# uses the bare `rounded-md` utility (confirmed by grep), so this would have
|
||||||
|
# silently grown its corner radius from Tailwind's stock 6px to shadcn's 8px.
|
||||||
|
# Scoping wouldn't fix it either: outside the scope var(--radius-md) would be
|
||||||
|
# UNDEFINED, and Tailwind falls back to `unset` (radius 0) rather than its own
|
||||||
|
# stock default once a theme key is declared at all. Removing these four lines
|
||||||
|
# is the only clean fix — Tailwind's stock scale then applies uniformly, and
|
||||||
|
# assistant-ui's own components just use that stock scale instead of shadcn's,
|
||||||
|
# a difference nobody will notice.
|
||||||
|
for line in (
|
||||||
|
" --radius-sm: calc(var(--radius) * 0.6);\n",
|
||||||
|
" --radius-md: calc(var(--radius) * 0.8);\n",
|
||||||
|
" --radius-lg: var(--radius);\n",
|
||||||
|
" --radius-xl: calc(var(--radius) * 1.4);\n",
|
||||||
|
):
|
||||||
|
assert line in s, f"missing: {line!r}"
|
||||||
|
s = s.replace(line, "")
|
||||||
|
|
||||||
|
# ── 6. In @theme inline: stop forcing Geist as the global sans font. ─────────
|
||||||
|
# --font-sans is also a Tailwind canonical key (drives the `font-sans` utility
|
||||||
|
# app-wide). WeLe already sets body { font-family: var(--font) } (Inter) as a
|
||||||
|
# plain, unlayered rule, which always wins over anything in a Tailwind layer
|
||||||
|
# per the CSS cascade-layers spec — so body content keeps using Inter either
|
||||||
|
# way. Removing this line just stops `font-sans` utility usage elsewhere from
|
||||||
|
# silently switching to Geist, and keeps the new AI Assistant UI visually
|
||||||
|
# consistent with the rest of the app instead of introducing a second typeface.
|
||||||
|
old_font = " --font-heading: var(--font-sans);\n --font-sans: 'Geist Variable', sans-serif;\n"
|
||||||
|
assert old_font in s, "font-sans lines not found"
|
||||||
|
s = s.replace(old_font, "")
|
||||||
|
|
||||||
|
# ── 7. Add the scoped theme block: `.aui-scope { ...light vars... }` plus
|
||||||
|
# `.aui-scope.dark { ...dark vars... }` for later if dark mode is ever
|
||||||
|
# added. Everything the assistant-ui components read via var(--foo)
|
||||||
|
# now only resolves inside an element carrying this class. ─────────────
|
||||||
|
scoped_block = f"""
|
||||||
|
/* ══════════════════════════════════════════════════ */
|
||||||
|
/* ASSISTANT-UI THEME SCOPE */
|
||||||
|
/* Semantic tokens (background/foreground/card/...) */
|
||||||
|
/* for the shadcn-based AI Assistant components. */
|
||||||
|
/* Deliberately NOT in :root — see fix-aui-css.py. */
|
||||||
|
/* ══════════════════════════════════════════════════ */
|
||||||
|
.aui-scope {{
|
||||||
|
{inner_vars}
|
||||||
|
}}
|
||||||
|
|
||||||
|
.aui-scope.dark {{
|
||||||
|
{dark_inner}
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
s = s.rstrip("\n") + "\n" + scoped_block
|
||||||
|
|
||||||
|
io.open(p, 'w', encoding='utf-8', newline='\n').write(s)
|
||||||
|
print("index.css rewritten")
|
||||||
Reference in New Issue
Block a user