Merge branch 'dev' into hugo
This commit is contained in:
commit
8a541211b7
2 files changed
+205
-22
No files matched your search
@@ -10,6 +10,7 @@ class Text2SQLService:
|
||||
_oracle_client_initialized = False
|
||||
_oracle_dll_handles = []
|
||||
_ASSET_AGENT_NAMES = {"固资管理"}
|
||||
_ASSET_ALLOWED_OPERATING_CENTER_CODES = ("HXJM", "HTT", "HTE")
|
||||
_ASSET_TABLE_MARKERS = (
|
||||
"ERP_VIEW_USER.ERP_FAJ_FILE_V",
|
||||
"ERP_VIEW_USER.ERP_FAB_FILE_V",
|
||||
@@ -113,6 +114,14 @@ class Text2SQLService:
|
||||
_ASSET_NAME_HINT_PATTERN = re.compile(
|
||||
r"(?:机|设备|系统|软件|电脑|打印机|服务器|模具|工装|平台|车辆|空调|机床|产线|生产线)$"
|
||||
)
|
||||
_ASSET_SELF_QUERY_MARKERS = (
|
||||
"我",
|
||||
"本人",
|
||||
"自己",
|
||||
"当前用户",
|
||||
"当前登录用户",
|
||||
"登录用户",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _backend_dir() -> str:
|
||||
@@ -482,6 +491,8 @@ class Text2SQLService:
|
||||
text = cls._strip_asset_query_prefix(query)
|
||||
if not text:
|
||||
return ""
|
||||
if cls._is_self_asset_query(text):
|
||||
return ""
|
||||
match = cls._ASSET_PERSON_PATTERN.search(text)
|
||||
if match:
|
||||
candidate = cls._clean_asset_scope_value(match.group(1))
|
||||
@@ -499,7 +510,7 @@ class Text2SQLService:
|
||||
candidate = cls._clean_asset_scope_value(match.group(1))
|
||||
if not candidate:
|
||||
continue
|
||||
if candidate in {"我", "本人", "自己", "当前登录用户", "当前用户", "登录用户", "公司"}:
|
||||
if candidate in {*cls._ASSET_SELF_QUERY_MARKERS, "公司"}:
|
||||
continue
|
||||
if any(marker in candidate for marker in ("有哪些", "有多少", "多少", "固定资产", "固资", "资产")):
|
||||
continue
|
||||
@@ -525,8 +536,7 @@ class Text2SQLService:
|
||||
text = cls._strip_asset_query_prefix(query)
|
||||
if not text:
|
||||
return False
|
||||
self_markers = ("我", "本人", "自己", "当前登录用户", "当前用户", "登录用户")
|
||||
if not any(marker in text for marker in self_markers):
|
||||
if not any(marker in text for marker in cls._ASSET_SELF_QUERY_MARKERS):
|
||||
return False
|
||||
return bool(re.search(r"(固定资产|固资|资产)", text))
|
||||
|
||||
@@ -570,7 +580,7 @@ class Text2SQLService:
|
||||
continue
|
||||
if cls._ASSET_SUFFIX_DEPARTMENT_PATTERN.fullmatch(keyword):
|
||||
continue
|
||||
if keyword in {"我", "本人", "自己", "当前登录用户", "当前用户", "登录用户"}:
|
||||
if keyword in cls._ASSET_SELF_QUERY_MARKERS:
|
||||
continue
|
||||
if cls._looks_like_person_name(keyword):
|
||||
continue
|
||||
@@ -578,8 +588,100 @@ class Text2SQLService:
|
||||
return ""
|
||||
|
||||
@classmethod
|
||||
def _build_asset_name_detail_sql(cls, keyword: str) -> str:
|
||||
def _extract_asset_nature_code(cls, query: str) -> str:
|
||||
text = cls._strip_asset_query_prefix(query)
|
||||
if not text:
|
||||
return ""
|
||||
if "无形资产" in text:
|
||||
return "2"
|
||||
if "有形资产" in text:
|
||||
return "1"
|
||||
if "土地" in text:
|
||||
return "3"
|
||||
if "递耗资产" in text:
|
||||
return "4"
|
||||
if "费用" in text:
|
||||
return "5"
|
||||
return ""
|
||||
|
||||
@classmethod
|
||||
def _build_asset_nature_condition(cls, base_alias: str, query: str) -> str:
|
||||
nature_code = cls._extract_asset_nature_code(query)
|
||||
if not nature_code:
|
||||
return ""
|
||||
return f"TRIM(NVL({base_alias}.faj09, '')) = '{nature_code}'"
|
||||
|
||||
@classmethod
|
||||
def _build_asset_person_condition(cls, base_alias: str, query: str) -> str:
|
||||
explicit_person = cls._extract_explicit_asset_person(query)
|
||||
if not explicit_person:
|
||||
return ""
|
||||
literal = cls._escape_sql_literal(re.sub(r"\s+", "", explicit_person))
|
||||
return (
|
||||
"EXISTS ("
|
||||
"SELECT 1 FROM ERP_VIEW_USER.ERP_GEN_FILE_V gen_scope "
|
||||
f"WHERE gen_scope.gen01 = {base_alias}.faj19 "
|
||||
f"AND gen_scope.site = {base_alias}.site "
|
||||
f"AND REGEXP_REPLACE(TRIM(gen_scope.gen02), '\\s+', '') = '{literal}'"
|
||||
")"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _build_self_asset_condition(cls, base_alias: str, query: str, user_context: dict | None = None) -> str:
|
||||
if not cls._is_self_asset_query(query):
|
||||
return ""
|
||||
normalized_user = user_context or {}
|
||||
username = str(normalized_user.get("username") or "").strip()
|
||||
employee_id = str(normalized_user.get("employee_id") or "").strip()
|
||||
real_name = str(normalized_user.get("real_name") or "").strip()
|
||||
|
||||
id_candidates: list[str] = []
|
||||
for raw_value in (employee_id, username):
|
||||
value = str(raw_value or "").strip()
|
||||
if value and value not in id_candidates:
|
||||
id_candidates.append(value)
|
||||
|
||||
predicates: list[str] = []
|
||||
if id_candidates:
|
||||
literals = ", ".join(f"'{cls._escape_sql_literal(value)}'" for value in id_candidates)
|
||||
predicates.append(f"TRIM(NVL({base_alias}.faj19, '')) IN ({literals})")
|
||||
if real_name:
|
||||
literal = cls._escape_sql_literal(re.sub(r"\s+", "", real_name))
|
||||
predicates.append(
|
||||
"EXISTS ("
|
||||
"SELECT 1 FROM ERP_VIEW_USER.ERP_GEN_FILE_V gen_self "
|
||||
f"WHERE gen_self.gen01 = {base_alias}.faj19 "
|
||||
f"AND gen_self.site = {base_alias}.site "
|
||||
f"AND REGEXP_REPLACE(TRIM(gen_self.gen02), '\\s+', '') = '{literal}'"
|
||||
")"
|
||||
)
|
||||
|
||||
if not predicates:
|
||||
return ""
|
||||
if len(predicates) == 1:
|
||||
return predicates[0]
|
||||
return "(" + " OR ".join(predicates) + ")"
|
||||
|
||||
@classmethod
|
||||
def _build_asset_department_condition(cls, base_alias: str, query: str) -> str:
|
||||
explicit_department = cls._extract_explicit_asset_department(query)
|
||||
if not explicit_department:
|
||||
return ""
|
||||
literal = cls._escape_sql_literal(re.sub(r"\s+", "", explicit_department))
|
||||
return (
|
||||
"EXISTS ("
|
||||
"SELECT 1 FROM ERP_VIEW_USER.ERP_GEM_FILE_V gem_scope "
|
||||
f"WHERE gem_scope.gem01 = {base_alias}.faj20 "
|
||||
f"AND gem_scope.site = {base_alias}.site "
|
||||
f"AND REGEXP_REPLACE(TRIM(gem_scope.gem02), '\\s+', '') = '{literal}'"
|
||||
")"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _build_asset_name_detail_sql(cls, keyword: str, query: str = "") -> str:
|
||||
literal = cls._escape_sql_literal(keyword)
|
||||
nature_condition = cls._build_asset_nature_condition("faj", query)
|
||||
nature_sql = f"\n AND {nature_condition}" if nature_condition else ""
|
||||
return f"""
|
||||
SELECT DISTINCT
|
||||
faj.faj02 AS "财产编号",
|
||||
@@ -605,8 +707,11 @@ LEFT JOIN ERP_VIEW_USER.ERP_GEM_FILE_V gem
|
||||
LEFT JOIN ERP_VIEW_USER.ERP_FAF_FILE_V faf
|
||||
ON faf.faf01 = faj.faj21
|
||||
AND faf.site = faj.site
|
||||
WHERE UPPER(NVL(faj.faj06, ' ')) LIKE '%' || UPPER('{literal}') || '%'
|
||||
OR UPPER(NVL(faj.faj061, ' ')) LIKE '%' || UPPER('{literal}') || '%'
|
||||
WHERE (
|
||||
UPPER(NVL(faj.faj06, ' ')) LIKE '%' || UPPER('{literal}') || '%'
|
||||
OR UPPER(NVL(faj.faj061, ' ')) LIKE '%' || UPPER('{literal}') || '%'
|
||||
)
|
||||
{nature_sql}
|
||||
ORDER BY faj.faj02
|
||||
""".strip()
|
||||
|
||||
@@ -622,8 +727,10 @@ ORDER BY faj.faj02
|
||||
return bool(re.search(r"(明细|列表|有哪些|有什么)", text))
|
||||
|
||||
@classmethod
|
||||
def _build_company_asset_detail_sql(cls) -> str:
|
||||
return """
|
||||
def _build_company_asset_detail_sql(cls, query: str = "") -> str:
|
||||
nature_condition = cls._build_asset_nature_condition("faj", query)
|
||||
nature_sql = f"WHERE {nature_condition}\n" if nature_condition else ""
|
||||
return f"""
|
||||
SELECT DISTINCT
|
||||
faj.faj02 AS "财产编号",
|
||||
faj.faj06 AS "中文名称",
|
||||
@@ -650,6 +757,7 @@ LEFT JOIN ERP_VIEW_USER.ERP_GEM_FILE_V gem
|
||||
LEFT JOIN ERP_VIEW_USER.ERP_FAF_FILE_V faf
|
||||
ON faf.faf01 = faj.faj21
|
||||
AND faf.site = faj.site
|
||||
{nature_sql}\
|
||||
ORDER BY faj.faj02
|
||||
""".strip()
|
||||
|
||||
@@ -658,11 +766,11 @@ ORDER BY faj.faj02
|
||||
if not (cls._is_asset_management_agent(agent) or cls._looks_like_asset_query(query)):
|
||||
return None
|
||||
if cls._is_company_asset_detail_query(query):
|
||||
return cls._build_company_asset_detail_sql()
|
||||
return cls._build_company_asset_detail_sql(query)
|
||||
keyword = cls._extract_asset_name_keyword(query)
|
||||
if not keyword:
|
||||
return None
|
||||
return cls._build_asset_name_detail_sql(keyword)
|
||||
return cls._build_asset_name_detail_sql(keyword, query)
|
||||
|
||||
@classmethod
|
||||
def _build_asset_prompt_constraints(cls, query: str, user_context: dict | None, agent) -> str:
|
||||
@@ -677,6 +785,8 @@ ORDER BY faj.faj02
|
||||
explicit_person = explicit_scope.get("person")
|
||||
explicit_department = explicit_scope.get("department")
|
||||
self_query = cls._is_self_asset_query(query)
|
||||
asset_nature_code = cls._extract_asset_nature_code(query)
|
||||
asset_nature_name = cls._ASSET_VALUE_MAPPINGS.get("资产性质", {}).get(asset_nature_code, "")
|
||||
|
||||
if explicit_person:
|
||||
filters.append(f"- 用户已明确指定查询人:{explicit_person}。本次必须以该指定人作为保管人查询固定资产,不能回退到当前登录用户。")
|
||||
@@ -689,13 +799,17 @@ ORDER BY faj.faj02
|
||||
f"- 必须联表 ERP_VIEW_USER.ERP_GEM_FILE_V `gem`,并通过 `gem.gem01 = faj.faj20 AND gem.site = faj.site AND TRIM(gem.gem02) = '{explicit_department}'` 过滤。"
|
||||
)
|
||||
elif self_query:
|
||||
filters.append("- 用户当前是以“我 / 本人 / 当前用户”口径查询固定资产,本次必须只查询当前登录用户相关固资。")
|
||||
filters.append("- 用户当前是以“我 / 本人 / 自己 / 当前用户 / 当前登录用户”口径查询固定资产,本次必须只查询当前登录用户相关固资。")
|
||||
if username := normalized_user.get("username"):
|
||||
filters.append(f"- 当前登录用户账号:{username}。如资产编码字段使用登录账号存储,需一并纳入过滤。")
|
||||
if employee_id:
|
||||
filters.append(f"- 当前登录用户工号:{employee_id}。优先直接使用 `faj19 = '{employee_id}'` 过滤。")
|
||||
if real_name:
|
||||
filters.append(
|
||||
f"- 如需联表保管人姓名,请通过 ERP_VIEW_USER.ERP_GEN_FILE_V `gen`,并使用 `gen.gen01 = faj.faj19 AND gen.site = faj.site AND TRIM(gen.gen02) = '{real_name}'`。"
|
||||
)
|
||||
if asset_nature_code and asset_nature_name:
|
||||
filters.append(f"- 用户已明确指定资产性质为“{asset_nature_name}”,必须增加 `TRIM(NVL(faj.faj09, '')) = '{asset_nature_code}'` 过滤,不能返回其他资产性质。")
|
||||
|
||||
return "\n".join(
|
||||
[
|
||||
@@ -703,6 +817,7 @@ ORDER BY faj.faj02
|
||||
"- 固定资产查询优先使用 ERP_VIEW_USER.ERP_FAJ_FILE_V,表别名建议使用 `faj`。",
|
||||
"- 如需资产类型、保管人姓名、部门名称或存放位置名称,可联表 ERP_VIEW_USER.ERP_FAB_FILE_V `fab`、ERP_VIEW_USER.ERP_GEN_FILE_V `gen`、ERP_VIEW_USER.ERP_GEM_FILE_V `gem`、ERP_VIEW_USER.ERP_FAF_FILE_V `faf`。",
|
||||
"- 固资相关联表必须同时补齐 `site` 条件,例如 `gen.site = faj.site`、`gem.site = faj.site`、`faf.site = faj.site`、`fab.site = faj.site`,避免同编码跨营运中心造成重复记录。",
|
||||
"- 固资数据只允许保留 `faj22`(存放营运中心)属于 `HXJM`、`HTT`、`HTE` 的记录;生成 SQL 时必须显式加上 `UPPER(TRIM(NVL(faj.faj22, ''))) IN ('HXJM', 'HTT', 'HTE')` 过滤。",
|
||||
"- 查询固定资产明细列表时优先使用 `SELECT DISTINCT`;如果是统计资产数量,优先使用 `COUNT(DISTINCT faj.faj02)`。",
|
||||
"- 返回结果所有列必须使用中文别名,例如 `faj.faj02 AS \"财产编号\"`、`faj.faj06 AS \"资产名称\"`、`faj.faj08 AS \"规格型号\"`。",
|
||||
"- 日期时间字段展示时不要去掉时分秒;若使用 TO_CHAR 格式化,必须保留为 `YYYY-MM-DD HH24:MI:SS`,不能只输出日期。",
|
||||
@@ -774,6 +889,23 @@ ORDER BY faj.faj02
|
||||
text = str(sql or "").strip().rstrip(";")
|
||||
return re.sub(r"(?is)\border\s+by\b[\s\S]*$", "", text).strip()
|
||||
|
||||
@classmethod
|
||||
def _build_asset_operating_center_condition(cls, base_alias: str) -> str:
|
||||
allowed_codes = ", ".join(f"'{code}'" for code in cls._ASSET_ALLOWED_OPERATING_CENTER_CODES)
|
||||
return f"UPPER(TRIM(NVL({base_alias}.faj22, ''))) IN ({allowed_codes})"
|
||||
|
||||
@staticmethod
|
||||
def _append_sql_predicate(sql: str, predicate: str) -> str:
|
||||
text = str(sql or "").strip().rstrip(";")
|
||||
anchor = re.search(r"(?is)\b(group\s+by|order\s+by|having)\b", text)
|
||||
if re.search(r"(?is)\bwhere\b", text):
|
||||
if anchor:
|
||||
return f"{text[:anchor.start()].rstrip()} AND {predicate} {text[anchor.start():].lstrip()}"
|
||||
return f"{text} AND {predicate}"
|
||||
if anchor:
|
||||
return f"{text[:anchor.start()].rstrip()} WHERE {predicate} {text[anchor.start():].lstrip()}"
|
||||
return f"{text} WHERE {predicate}"
|
||||
|
||||
@classmethod
|
||||
def _build_asset_total_count_sql(cls, sql: str) -> str | None:
|
||||
if cls._is_aggregate_sql(sql):
|
||||
@@ -902,6 +1034,31 @@ ORDER BY faj.faj02
|
||||
|
||||
return join_pattern.sub(_replace, sql)
|
||||
|
||||
@classmethod
|
||||
def _ensure_asset_operating_center_filter(cls, sql: str, base_alias: str) -> str:
|
||||
predicate = cls._build_asset_operating_center_condition(base_alias)
|
||||
return cls._append_sql_predicate(sql, predicate)
|
||||
|
||||
@classmethod
|
||||
def _ensure_asset_nature_filter(cls, sql: str, base_alias: str, query: str) -> str:
|
||||
predicate = cls._build_asset_nature_condition(base_alias, query)
|
||||
if not predicate:
|
||||
return sql
|
||||
return cls._append_sql_predicate(sql, predicate)
|
||||
|
||||
@classmethod
|
||||
def _ensure_asset_scope_filter(cls, sql: str, base_alias: str, query: str, user_context: dict | None = None) -> str:
|
||||
department_predicate = cls._build_asset_department_condition(base_alias, query)
|
||||
if department_predicate:
|
||||
return cls._append_sql_predicate(sql, department_predicate)
|
||||
person_predicate = cls._build_asset_person_condition(base_alias, query)
|
||||
if person_predicate:
|
||||
return cls._append_sql_predicate(sql, person_predicate)
|
||||
self_predicate = cls._build_self_asset_condition(base_alias, query, user_context=user_context)
|
||||
if self_predicate:
|
||||
return cls._append_sql_predicate(sql, self_predicate)
|
||||
return sql
|
||||
|
||||
@classmethod
|
||||
def _ensure_asset_select_distinct(cls, sql: str) -> str:
|
||||
if cls._is_aggregate_sql(sql):
|
||||
@@ -926,7 +1083,7 @@ ORDER BY faj.faj02
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _rewrite_asset_sql(cls, sql: str, query: str, agent=None) -> str:
|
||||
def _rewrite_asset_sql(cls, sql: str, query: str, agent=None, user_context: dict | None = None) -> str:
|
||||
if not cls._looks_like_asset_query(query, sql) and not cls._is_asset_management_agent(agent):
|
||||
return sql
|
||||
|
||||
@@ -938,6 +1095,9 @@ ORDER BY faj.faj02
|
||||
for table_name in ("ERP_GEN_FILE_V", "ERP_GEM_FILE_V", "ERP_FAF_FILE_V", "ERP_FAB_FILE_V"):
|
||||
normalized_sql = cls._ensure_asset_join_site(normalized_sql, base_alias, table_name)
|
||||
|
||||
normalized_sql = cls._ensure_asset_scope_filter(normalized_sql, base_alias, query, user_context=user_context)
|
||||
normalized_sql = cls._ensure_asset_nature_filter(normalized_sql, base_alias, query)
|
||||
normalized_sql = cls._ensure_asset_operating_center_filter(normalized_sql, base_alias)
|
||||
normalized_sql = cls._ensure_asset_datetime_precision(normalized_sql)
|
||||
return cls._ensure_asset_select_distinct(normalized_sql)
|
||||
|
||||
@@ -1011,7 +1171,7 @@ ORDER BY faj.faj02
|
||||
def generate_sql(cls, query: str, user_context: dict | None = None, agent=None) -> str:
|
||||
special_sql = cls._build_special_asset_sql(query, agent=agent)
|
||||
if special_sql:
|
||||
return special_sql
|
||||
return cls._rewrite_asset_sql(special_sql, query, agent=agent, user_context=user_context)
|
||||
|
||||
schema = cls.get_schema()
|
||||
asset_constraints = cls._build_asset_prompt_constraints(query, user_context, agent)
|
||||
@@ -1038,7 +1198,7 @@ ORDER BY faj.faj02
|
||||
user_prompt = f"用户问题:{query}"
|
||||
sql = cls._chat_completion(system_prompt, user_prompt, temperature=0)
|
||||
sql = sql.rstrip(";")
|
||||
sql = cls._rewrite_asset_sql(sql, query, agent=agent)
|
||||
sql = cls._rewrite_asset_sql(sql, query, agent=agent, user_context=user_context)
|
||||
|
||||
if not cls._is_safe_query(sql):
|
||||
return "SELECT 'Generated SQL was blocked because it is not a safe read-only SELECT query' AS error FROM DUAL"
|
||||
@@ -1051,7 +1211,7 @@ ORDER BY faj.faj02
|
||||
def repair_sql(cls, query: str, failed_sql: str, error_message: str, user_context: dict | None = None, agent=None) -> str:
|
||||
special_sql = cls._build_special_asset_sql(query, agent=agent)
|
||||
if special_sql:
|
||||
return special_sql
|
||||
return cls._rewrite_asset_sql(special_sql, query, agent=agent, user_context=user_context)
|
||||
|
||||
schema = cls.get_schema()
|
||||
invalid_identifier = cls._extract_invalid_identifier(error_message)
|
||||
@@ -1086,7 +1246,7 @@ ORDER BY faj.faj02
|
||||
try:
|
||||
sql = cls._chat_completion(system_prompt, user_prompt, temperature=0)
|
||||
sql = sql.rstrip(";")
|
||||
sql = cls._rewrite_asset_sql(sql, query, agent=agent)
|
||||
sql = cls._rewrite_asset_sql(sql, query, agent=agent, user_context=user_context)
|
||||
if not cls._is_safe_query(sql):
|
||||
return "SELECT 'Generated SQL was blocked because it is not a safe read-only SELECT query' AS error FROM DUAL"
|
||||
return sql
|
||||
|
||||
@@ -349,7 +349,11 @@ const renderMarkdown = (text: string) => {
|
||||
const displayText = sanitizeShippingConversationText(stripReasoningPrelude(stripped));
|
||||
try {
|
||||
// 把 # 标题、代码块、[链接](url) 等 Markdown 解析成 HTML
|
||||
return marked.parse(displayText);
|
||||
const rendered = marked.parse(displayText);
|
||||
const html = typeof rendered === 'string' ? rendered : displayText;
|
||||
return html.replace(/<table\b[\s\S]*?<\/table>/gi, (tableHtml: string) => (
|
||||
`<div class="chat-table-scroll"><div class="chat-table-inner">${tableHtml}</div></div>`
|
||||
));
|
||||
} catch (e) {
|
||||
return displayText;
|
||||
}
|
||||
@@ -4914,7 +4918,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="chat-markdown prose prose-sm max-w-none leading-7 text-primary prose-a:text-blue-600 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100 prose-table:w-full prose-table:border-collapse prose-th:border prose-th:border-slate-200 prose-th:bg-slate-50 prose-th:px-3 prose-th:py-2 prose-th:text-left prose-td:border prose-td:border-slate-200 prose-td:px-3 prose-td:py-2"
|
||||
class="chat-markdown prose prose-sm max-w-none leading-7 text-primary prose-a:text-blue-600 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100 prose-th:border prose-th:border-slate-200 prose-th:bg-slate-50 prose-th:px-3 prose-th:py-2 prose-th:text-left prose-td:border prose-td:border-slate-200 prose-td:px-3 prose-td:py-2"
|
||||
@click="handleChatMarkdownClick"
|
||||
v-html="renderMarkdown(msg.content)"
|
||||
></div>
|
||||
@@ -5658,10 +5662,28 @@ const showChatRating = ref(false);
|
||||
|
||||
</template>
|
||||
<style scoped>
|
||||
:deep(.chat-markdown table) {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
:deep(.chat-markdown) {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
:deep(.chat-markdown .chat-table-scroll) {
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
margin: 0.75rem 0;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
:deep(.chat-markdown .chat-table-inner) {
|
||||
width: max-content;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
:deep(.chat-markdown table) {
|
||||
width: max-content;
|
||||
min-width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 0;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
@@ -5671,6 +5693,7 @@ const showChatRating = ref(false);
|
||||
padding: 0.5rem 0.75rem;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
:deep(.chat-markdown th) {
|
||||
|
||||
Reference in new issue
Block a user