Browse Source

style: 去除多余文件以及代码

sunxiao 8 months ago
parent
commit
bce46f0fed

+ 0 - 12
package-lock.json

@@ -18,8 +18,6 @@
         "markdown-it": "^14.1.0",
         "markdown-it-link-attributes": "^4.0.1",
         "markdown-it-math": "^4.1.1",
-        "markdown-it-sub": "^2.0.0",
-        "markdown-it-sup": "^2.0.0",
         "markdown-it-texmath": "^1.0.0",
         "naive-ui": "^2.38.2",
         "pinia": "^2.1.7",
@@ -4603,16 +4601,6 @@
         "ascii2mathml": "^0.6.2"
       }
     },
-    "node_modules/markdown-it-sub": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmmirror.com/markdown-it-sub/-/markdown-it-sub-2.0.0.tgz",
-      "integrity": "sha512-iCBKgwCkfQBRg2vApy9vx1C1Tu6D8XYo8NvevI3OlwzBRmiMtsJ2sXupBgEA7PPxiDwNni3qIUkhZ6j5wofDUA=="
-    },
-    "node_modules/markdown-it-sup": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmmirror.com/markdown-it-sup/-/markdown-it-sup-2.0.0.tgz",
-      "integrity": "sha512-5VgmdKlkBd8sgXuoDoxMpiU+BiEt3I49GItBzzw7Mxq9CxvnhE/k09HFli09zgfFDRixDQDfDxi0mgBCXtaTvA=="
-    },
     "node_modules/markdown-it-texmath": {
       "version": "1.0.0",
       "resolved": "https://registry.npmmirror.com/markdown-it-texmath/-/markdown-it-texmath-1.0.0.tgz",

+ 0 - 88
src/assets/base.css

@@ -1,88 +0,0 @@
-/* color palette from <https://github.com/vuejs/theme> */
-:root {
-  --vt-c-white: #ffffff;
-  --vt-c-white-soft: #f8f8f8;
-  --vt-c-white-mute: #f2f2f2;
-
-  --vt-c-black: #181818;
-  --vt-c-black-soft: #222222;
-  --vt-c-black-mute: #282828;
-
-  --vt-c-indigo: #2c3e50;
-
-  --vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
-  --vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
-  --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
-  --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
-
-  --vt-c-text-light-1: var(--vt-c-indigo);
-  --vt-c-text-light-2: rgba(60, 60, 60, 0.66);
-  --vt-c-text-dark-1: var(--vt-c-white);
-  --vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
-
-}
-
-/* semantic color variables for this project */
-:root {
-  --color-background: var(--vt-c-white);
-  --color-background-soft: var(--vt-c-white-soft);
-  --color-background-mute: var(--vt-c-white-mute);
-
-  --color-border: var(--vt-c-divider-light-2);
-  --color-border-hover: var(--vt-c-divider-light-1);
-
-  --color-heading: var(--vt-c-text-light-1);
-  --color-text: var(--vt-c-text-light-1);
-
-  --section-gap: 160px;
-}
-
-@media (prefers-color-scheme: dark) {
-  :root {
-    --color-background: var(--vt-c-black);
-    --color-background-soft: var(--vt-c-black-soft);
-    --color-background-mute: var(--vt-c-black-mute);
-
-    --color-border: var(--vt-c-divider-dark-2);
-    --color-border-hover: var(--vt-c-divider-dark-1);
-
-    --color-heading: var(--vt-c-text-dark-1);
-    --color-text: var(--vt-c-text-dark-2);
-  }
-}
-
-*,
-*::before,
-*::after {
-  box-sizing: border-box;
-  margin: 0;
-  font-weight: normal;
-}
-
-body {
-  min-height: 100vh;
-  color: var(--color-text);
-  background: var(--color-background);
-  transition:
-    color 0.5s,
-    background-color 0.5s;
-  line-height: 1.6;
-  font-family:
-    Inter,
-    -apple-system,
-    BlinkMacSystemFont,
-    'Segoe UI',
-    Roboto,
-    Oxygen,
-    Ubuntu,
-    Cantarell,
-    'Fira Sans',
-    'Droid Sans',
-    'Helvetica Neue',
-    sans-serif;
-  font-size: 15px;
-  text-rendering: optimizeLegibility;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-}
-

+ 0 - 1
src/assets/logo.svg

@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>

+ 0 - 36
src/assets/main.css

@@ -1,36 +0,0 @@
-@import './base.css';
-
-#app {
-  max-width: 1280px;
-  margin: 0 auto;
-  padding: 2rem;
-  font-weight: normal;
-}
-
-a,
-.green {
-  text-decoration: none;
-  color: hsla(160, 100%, 37%, 1);
-  transition: 0.4s;
-  padding: 3px;
-}
-
-@media (hover: hover) {
-  a:hover {
-    background-color: hsla(160, 100%, 37%, 0.2);
-  }
-}
-
-@media (min-width: 1024px) {
-  body {
-    display: flex;
-    place-items: center;
-  }
-
-  #app {
-    display: grid;
-    grid-template-columns: 1fr 1fr;
-    padding: 0 2rem;
-  }
-}
-

+ 0 - 184
src/components/Chat/ChatAnswer - source.vue

@@ -1,184 +0,0 @@
-<script setup>
-import { computed, unref } from 'vue';
-import { useMessage } from 'naive-ui';
-import { useClipboard } from '@vueuse/core'
-import MarkdownIt from 'markdown-it';
-import hljs from 'highlight.js';
-import mila from 'markdown-it-link-attributes';
-// import markdownItLatex from 'markdown-it-latex'
-// import mdKatex from '@traptitech/markdown-it-katex';
-import mdKatex from 'markdown-it-katex';
-import { SvgIcon } from '@/components';
-import { chatApi } from "@/api/chat"
-
-// import 'markdown-it-latex/dist/index.css'
-
-const props = defineProps({
-  id: {
-    type: [String, Number],
-    default: ''
-  },
-  content: {
-    type: String,
-    default: ''
-  },
-  loading: {
-    type: Boolean,
-    default: false
-  },
-  delayLoading: {
-    type: Boolean,
-    default: false
-  },
-  isSatisfied: {
-    type: Number,
-    default: 2
-  }
-})
-
-const emit = defineEmits(['on-click-icon']);
-
-const { copy } = useClipboard();
-const message = useMessage();
-
-function highlightBlock(str, lang) {
-  return `<pre class="code-block-wrapper"><div class="code-block-header"><span class="code-block-header__copy"></span></div><code class="hljs code-block-body ${lang}">${str}</code></pre>`
-}
-
-const mdi = new MarkdownIt({
-  html: true,
-  linkify: true,
-  // breaks: true,
-  typographer: true,
-  highlight(code, language) {
-    const validLang = !!(language && hljs.getLanguage(language))
-    if (validLang) {
-      const lang = language ?? ''
-      return highlightBlock(hljs.highlight(code, { language: lang }).value, lang)
-    }
-    return highlightBlock(hljs.highlightAuto(code).value, '')
-  },
-})
-
-mdi.use(mila, { attrs: { target: '_blank', rel: 'noopener' } })
-mdi.use(mdKatex, { blockClass: 'katexmath-block rounded-md p-[10px]', errorColor: ' #cc0000' })
-// mdi.use(markdownItLatex)
-
-const text = computed(() => {
-  const value = props.content ?? ""
-  if (!props.asRawText)
-    return mdi.render(value)
-  return value
-})
-
-const handlLeToggleLike = async (state) => {
-  const { id } = unref(props);
-  const isSatisfied = props.isSatisfied === state ? 2 : state;
-  const params = { id, isSatisfied };
-  
-  await chatApi.putIsSatisfiedAnswer(params);
-
-  isSatisfied < 2 ? message.success('感谢您的反馈') : message.success('已取消反馈');
-
-  emit('on-click-icon', params)
-}
-
-const handleCopy = () => {
-  copy(props.content).then(() => {
-    message.success('复制成功');
-  })
-}
-</script>
-
-<template>
-  <div class="answer-inner">
-    <div :class="[ 'answer-card', 'px-[20px]', 'py-[20px]']">
-      <div class="chat-answer_icon relative flex-shrink-0">
-        <SvgIcon name="common-logo" class="chat-logo " size="30" :style="{ scale: loading ? 0 : 1 }" />
-        <div style="color: #2454FF" class="la-ball-circus la-dark la-sm flex-shrink-0" v-show="loading">
-          <div v-for="item in 5" :key="item"></div>
-        </div>
-      </div>
-      <div class="flex-1 pt-[4px] ml-[16px] text-[15px]">
-        <template v-if="loading && delayLoading">
-          <p class="font-bold text-[#1A2029] leading-[24px]">内容生成中...</p>
-        </template>
-        <div class="markdown-body text-[15px]" v-if="content">
-          <div v-html="text"></div>
-        </div>
-        <!-- <template> -->
-          <slot></slot>
-        <!-- </template> -->
-      </div>
-    </div>
-    <ul class="answer-btn-group" v-if="!loading">
-      <li class="btn" @click="handleCopy">
-        <SvgIcon name="chat-icon-copy" size="16" />
-      </li>
-      <li class="line"></li>
-      <li :class="['btn', { btn_active: isSatisfied == 1 }]">
-        <SvgIcon name="chat-icon-yes" size="16" @click="handlLeToggleLike(1)" />
-      </li>
-      <li class="line"></li>
-      <li :class="['btn', { btn_active: isSatisfied == 0 }]">
-        <SvgIcon name="chat-icon-no" size="16" @click="handlLeToggleLike(0)" />
-      </li>
-    </ul>
-  </div>
-
-</template>
-
-<style lang="scss">
-.markdown-body p:last-child {
-  margin-bottom: 0;
-}
-
-.markdown-body  {
-  p:last-child {
-    margin-bottom: 0;
-  }
-  img {
-    margin-top: 20px;
-  }
-}
-
-.chat-logo {
-  position: absolute;
-  transition: all 1s;
-}
-
-.answer-inner {
-  margin-bottom: 20px;
-
-  .answer-card {
-    @include flex(x, start, start);
-    // padding: 20px 20px 4px 20px;
-    border-radius: 8px;
-    background: #fff;
-  }
-
-  .answer-btn-group {
-    @include flex(x, center, end);
-    padding-top: 6px;
-
-    .btn {
-      @include flex(x, center, center);
-      @include layout(28px, 28px, 4px);
-      color: #89909B;
-      cursor: pointer;
-
-      &:hover, &_active {
-        background: #DBEFFF;
-        color: #2454FF;
-      }
-
-    }
-
-    .line {
-      @include layout(1px, 12px, 0);
-      margin: 0 5px;
-      background: #D3D0E1;
-    }
-  }
-}
-</style>

+ 0 - 192
src/components/Chat/ChatText - last.vue

@@ -1,192 +0,0 @@
-<script setup>
-import { computed, onMounted , ref} from 'vue';
-import MarkdownIt from 'markdown-it';
-import hljs from 'highlight.js';
-import mila from 'markdown-it-link-attributes';
-import markdownItMath from 'markdown-it-math';
-import mdKatex from 'markdown-it-katex';
-const formulaContainer  = ref(null);
-const props = defineProps({
-  content: {
-    type: String,
-    default: ''
-  }
-})
-
-const highlightBlock = (str, lang) => {
-  return `
-  <code class="hljs code-block-body ${lang}">${str}</code>
-    `
-}
-
-const mdi = new MarkdownIt({
-  html: true,
-  linkify: true,
-  breaks: true,
-  typographer: true,
-  highlight(code, language) {
-    const validLang = !!(language && hljs.getLanguage(language))
-    if (validLang) {
-      const lang = language ?? ''
-      return highlightBlock(hljs.highlight(code, { language: lang }).value, lang)
-    }
-    return highlightBlock(hljs.highlightAuto(code).value, '')
-  },
-})
-
-mdi.renderer.rules.table_open = function (tokens, idx, options, env, self) { return '<div class="custom-table-wrapper"><table>'; };
-mdi.renderer.rules.table_close = function () { return '</table></div>'; };
-
-mdi.use(mila, { attrs: { target: '_blank', rel: 'noopener' } });
-
-mdi.use(markdownItMath, {
-  inlineOpen: '\\(',
-  inlineClose: '\\)',
-  blockOpen: '\\[',
-  blockClose: '\\]'
-});
-
-mdi.use(mdKatex, {
-  blockClass: 'katexmath-block rounded-md p-[10px]',
-  errorColor: ' #cc0000',
-})
-
-const text = computed(() => {
-  const value = props.content ?? ""
-  if (!props.asRawText)
-    return mdi.render(value)
-  return value
-})
-
-
-
-
-const defaultImageRender = mdi.renderer.rules.image;
-
-
-
-
-
-function modifyImageSrc(src) {
-  if (src.startsWith('http')) {
-    // 图片是绝对路径,不做修改
-    return src;
-  } else {
-    // 假设所有相对路径图片都需要添加前缀
-    return `https://your-cdn.com/images/${src}`;
-  }
-}
-
-const md = new MarkdownIt();
-// 自定义规则以匹配 AA 开头的内容
-md.core.ruler.push('custom_aa_rule', function (state) {
-  state.tokens.forEach(function (token, index) {
-    // console.log( token, index );
-    if (token.type === 'inline' && token.content.match(/^AA/)) {
-      // 创建一个新的 token 来表示自定义的渲染
-      let customToken = new state.Token('custom_aa_open', 'div', 1);
-      customToken.block = true;
-      customToken.attrs = [['class', 'aa-custom-class']];
-
-      let textToken = new state.Token('text', '', 0);
-      textToken.content = token.content;
-
-      let closeToken = new state.Token('custom_aa_close', 'div', -1);
-      closeToken.block = true;
-
-      // 插入新 tokens 并移除原始 token
-      state.tokens.splice(index, 1, customToken, textToken, closeToken);
-    }
-  });
-});
-
-md.renderer.rules['custom_aa_open'] = function () { return '<div class="aa-custom-class">'; };
-md.renderer.rules['custom_aa_close'] = function () { return '</div>'; };
-let result = md.render(`臭氧层的形成与耗损是一个涉及化学反应的关键过程,它对于地球生物的生存至关重要。臭氧(O3)主要通过以下两个化学反应来调控其在大气层中的浓度:
-
-1. 形成过程(紫外线催化):
-   在紫外线(UV)的作用下,氧气分子(O2)接受能量(hν,表示光子能量),经历一个激发态的过程,发生以下反应:
-   \[
-   \mathcal{O}_2 + h\nu \rightarrow O^{\cdot} + O^{\cdot}
-   \]
-   紧接着,两个单个氧原子(O•)在存在中间物质M(通常为大气中的其他分子如氮气或氢)的情况下,结合生成臭氧分子:
-   \[
-   O^{\cdot} + O^{\cdot} + M \rightarrow O_3 + M
-   \]
-
-2. 耗损过程:
-   臭氧在吸收更多紫外线后会发生分解,首先是单线程反应:
-   \[
-   O_3 + h\nu \rightarrow O_2 + O^{\cdot}
-   \]
-   而在大气条件下,进一步的反应会导致臭氧分子与一个单个氧原子结合,形成两个氧气分子:
-   \[
-   O_3 + O^{\cdot} \rightarrow 2O_2
-   \]
-
-这两个反应(反应2和3)在平流层中持续循环,它们吸收大量的紫外线辐射,起到了地球生物的天然遮阳伞作用。然而,这个动态平衡一旦被破坏,例如由于人类活动产生的化学物质(如氯氟碳化物CFCs)的排放,臭氧层的稳定性就会受到威胁。
-
-总之,臭氧层的形成与耗损是一个复杂的光化学过程,它在平流层中维持着微妙的平衡,确保地球免受有害紫外线的直接照射。任何影响这个平衡的因素都可能对生态系统产生深远影响。`);
-
-// md.renderer.rules['custom_aa_open'] = function () { return '<div class="aa-custom-class">'; };
-// md.renderer.rules['custom_aa_close'] = function () { return '</div>'; };
-
-const img = mdi.render('![](https://image.pollinations.ai/prompt/%E4%B8%80%E5%8F%AA%E7%8C%AB) 这是一只我为你画的猫。![](https://image.pollinations.ai/prompt/%E4%B8%80%E5%8F%AA%E7%8C%AB) 第二只第二只。')
-
-
-const res123 = mdi.render(`$$P_{待估} = \\frac{1/a}{1/a+1/b+1/c}*P_A+\\frac{1/b}{1/a+1/b+1/c}*P_B+\\frac{1/c}{1/a+1/b+1/c}*P_C$$`)
-
-
-</script>
-
-<template>
-  <div ref="formulaContainer" class="formula-container"></div>
-  <div class="markdown-body text-[15px] break-all" v-if="content">
-    <!-- <div v-html="result"></div> -->
-    <div v-html="text"></div>
-  </div>
-</template>
-
-<style>
-.markdown-body p:last-child {
-  margin-bottom: 0;
-}
-
-.markdown-body {
-
-  .custom-table-wrapper {
-    width: 710px;
-    margin-bottom: 16px;
-    overflow-x: scroll;
-
-    &::-webkit-scrollbar {
-      height: 4px;
-    }
-
-    &::-webkit-scrollbar-thumb {
-      background: #ebf0f9;
-    }
-
-    &::-webkit-scrollbar-track {
-      background: #f7f8fc;
-    }
-  }
-
-  p:last-child {
-    margin-bottom: 0;
-  }
-
-  /* img {
-    margin-top: 20px;
-  }
-
-  table {
-
-    thead {
-      strong {
-        font-size: 12px;
-      }
-    }
-  } */
-}
-</style>

+ 0 - 135
src/components/Chat/ChatText - old.vue

@@ -1,135 +0,0 @@
-<script setup>
-import { computed } from 'vue';
-import MarkdownIt from 'markdown-it';
-import hljs from 'highlight.js';
-import mila from 'markdown-it-link-attributes';
-import markdownItMath from 'markdown-it-math';
-import mdKatex from 'markdown-it-katex';
-
-const props = defineProps({
-  content: {
-    type: String,
-    default: ''
-  }
-})
-
-const highlightBlock = (str, lang) => {
-  return `
-  <pre class="code-block-wrapper">
-    <div class="code-block-header">
-      <span class="code-block-header__copy"></span>
-    </div>
-    <code class="hljs code-block-body ${lang}">${str}</code>
-  </pre>`
-}
-
-const mdi = new MarkdownIt({
-  html: true,
-  linkify: true,
-  breaks: true,
-  typographer: true,
-  highlight(code, language) {
-    const validLang = !!(language && hljs.getLanguage(language))
-    if (validLang) {
-      const lang = language ?? ''
-      return highlightBlock(hljs.highlight(code, { language: lang }).value, lang)
-    }
-    return highlightBlock(hljs.highlightAuto(code).value, '')
-  },
-})
-
-mdi.use(mila, { attrs: { target: '_blank', rel: 'noopener' } })
-
-mdi.use(markdownItMath, {
-  inlineOpen: '\\(',
-  inlineClose: '\\)',
-  blockOpen: '\\[',
-  blockClose: '\\]'
-});
-mdi.use(mdKatex, {
-  blockClass: 'katexmath-block rounded-md p-[10px]', 
-  errorColor: ' #cc0000',
-})
-
-const text = computed(() => {
-  const value = props.content ?? ""
-  if (!props.asRawText)
-    return mdi.render(value)
-  return value
-})
-
-// const markdownText = '$$\mathcal{O}_{2} + h\nu \rightarrow O· + O·O';
-// const htmlOutput = mdi.render(markdownText);
-
-const md = new MarkdownIt();
-md.use(mdKatex, {
-  // 可以根据需要调整配置项,这里使用默认配置
-});
-const markdownText = `
-# 数学公式示例
-
-## 行内公式
-这是行内公式:$E=mc^2$。
-
-## 块级公式
-$$
-\\sum_{i=0}^{n} i = \\frac{n(n+1)}{2}
-$$
-
-## 分数
-\\[ \\frac{1}{x} + \\frac{1}{y} = \\frac{x+y}{xy} \\]
-
-## 指数与根号
-\\[ x^{n} \\quad \\sqrt[n]{x} \\]
-
-## 微积分
-\\[ \\int_{a}^{b} f(x)dx \\quad \\frac{d}{dx}f(x) \\]
-
-## 矩阵
-\\[
-\\begin{bmatrix}
-a & b \\
-c & d
-\\end{bmatrix}
-\\]
-
-## 向量
-\\( \\vec{v} = \\langle x, y, z \\rangle \\)
-`;
-const htmlOutput = md.render(markdownText);
-
-</script>
-
-<template>
-  <div class="markdown-body text-[15px] break-all" v-if="content">
-    <div v-html="htmlOutput"></div>
-    <hr>
-    <div v-html="text"></div>
-  </div>
-</template>
-
-<style>
-.markdown-body p:last-child {
-  margin-bottom: 0;
-}
-
-.markdown-body {
-
-  p:last-child {
-    margin-bottom: 0;
-  }
-
-  /* img {
-    margin-top: 20px;
-  }
-
-  table {
-
-    thead {
-      strong {
-        font-size: 12px;
-      }
-    }
-  } */
-}
-</style>

+ 0 - 165
src/components/Chat/demo.html

@@ -1,165 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
-  <meta charset="UTF-8">
-  <title>Markdown-it with MathJax</title>
-  <!-- 引入 MathJax CDN -->
-  <!-- <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> -->
-  <!-- <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> -->
-  <!-- <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-chtml.min.js"></script> -->
-  <script type="text/javascript" async
-    src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"></script>
-
-</head>
-
-<body>
-  <div id="content"></div>
-
-  <div class="latexDiv">
-    $$P_{待估} = \\frac{1/a}{1/a+1/b+1/c}*P_A+\\frac{1/b}{1/a+1/b+1/c}*P_B+\\frac{1/c}{1/a+1/b+1/c}*P_C$$
-    臭氧层的形成与耗损是一个复杂的化学过程,它涉及到大气中氧气(O2)的转化,尤其是在平流层中。其主要反应过程可以通过两个关键步骤来描述:
-
-1. **形成过程(光解反应)**:
-   - 当分子氧气(O2)吸收太阳紫外线(hν)时,会发生光解,生成一个氧原子(O·)和一个未结合的氧分子(0·O2)。这一反应可以用化学方程式表示为:
-     \[
-     \mathcal{O}_{2} + h\nu \rightarrow O· + O·O
-     \]
-   - 接着,这两个氧原子会相互结合生成一个臭氧分子(O3),即:
-     \[
-     O· + O·O \rightarrow O_3
-     \]
-   这些反应吸收了大量的紫外线,起到了地球生物的天然防晒屏作用。
-
-2. **耗损过程(还原反应)**:
-   - 臭氧分子在受到紫外线激发后,可能发生两个反应:一是直接返回到氧气状态,释放出一个氧原子,反应为:
-     \[
-     O_3 + h\nu \rightarrow O_2 + O·
-     \]
-   - 另一反应是臭氧与另一个氧原子结合,生成两个氧气分子,即:
-     \[
-     O_3 + O· \rightarrow 2O_2
-     \]
-   这两个过程共同维持了臭氧层的动态平衡。
-
-总的来说,平流层中的臭氧通过不断的生成与耗损,形成了一个微妙的平衡,这个平衡对于阻挡有害紫外线对地球表面生物至关重要。尽管紫外线照射不断促使臭氧的分解,但同样数量的臭氧通过上述反应得以再生,确保了地球生命得以在适宜的环境中繁衍。
-
-
-
-在水务工程中,有许多公式用于计算不同方面的参数,例如水流量、水压、水处理效率等。这里我给出一个简单的水流量计算公式,通常用于估算水管中的平均流速:
-
-**平均流速公式 (对于圆形管道)**:
-\[ V = \frac{Q}{A} \]
-
-其中:
-- \( V \) 是平均流速(通常以米每秒 m/s 表示),
-- \( Q \) 是流量(以立方米每秒 m³/s 或升每秒 L/s 表示,取决于单位要求),
-- \( A \) 是管道截面积(对于圆形管道,\( A = \pi r^2 \),其中 \( r \) 是管道半径,单位为米 m)。
-
-如果你需要其他类型的水务公式或者具体情境下的计算,请提供更多的信息,我会给出相应的公式或详细的解答。
-  </div>
-
-  <script src="https://markdown-it.github.io/markdown-it.js"></script>
-  <script>
-    // 初始化 markdown-it
-  const md = window.markdownit();
-
-    // 假设你的Markdown内容存储在一个变量中
-    const markdownContent = `你的Markdown内容,包括 LaTeX 公式如: $$P_{待估} = \\frac{1/a}{1/a+1/b+1/c}*P_A+\\frac{1/b}{1/a+1/b+1/c}*P_B+\\frac{1/c}{1/a+1/b+1/c}*P_C$$`;
-
-    // 使用 markdown-it 渲染Markdown到HTML
-    const htmlContent = md.render(markdownContent);
-
-    // 将渲染后的HTML插入到页面中
-    document.getElementById('content').innerHTML = htmlContent;
-    // MathJax.js
-
-    let isMathjaxConfig = false// 用于标识是否配置
-    const initMathjaxConfig = () => {
-      if (!window.MathJax) {
-        return
-      }
-      window.MathJax.Hub.Config({
-        showProcessingMessages: false, // 关闭js加载过程信息
-        messageStyle: 'none', // 不显示信息
-        // jax: ['input/TeX', 'output/HTML-CSS'],
-        tex2jax: {
-          inlineMath: [['$', '$'], ['\\(', '\\)']], // 行内公式选择符
-          displayMath: [['$$', '$$'], ['\\[', '\\]']], // 段内公式选择符
-          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code', 'a'] // 避开某些标签
-        },
-        'HTML-CSS': {
-          availableFonts: ['STIX', 'TeX'], // 可选字体
-          showMathMenu: false // 关闭右击菜单显示
-        }
-      })
-      isMathjaxConfig = true // 配置完成,改为true
-    }
-
-    const MathQueue = function (elementId) {
-      if (!window.MathJax) {
-        return
-      }
-      window.MathJax.Hub.Queue(['Typeset', window.MathJax.Hub, document.getElementsByClassName(elementId)]) // 根据class
-      window.MathJax.Hub.Queue(['Typeset', window.MathJax.Hub, document.getElementById(elementId)]) // 根据id
-    }
-
-    if (MathJax.isMathjaxConfig) { // 是否配置MathJax
-      MathJax.initMathjaxConfig()
-    }
-
-    MathJax.MathQueue('latexDiv') // 渲染对应的id/class
-
-
-  </script>
-</body>
-
-</html>
-
-
-
-
-const open = () => {
-
-  window.MathJax.config = {
-    tex: {
-      inlineMath: [['$', '$'], ['\\(', '\\)']],
-      displayMath: [['$$', '$$'], ['\\[', '\\]']],
-      processEscapes: true,
-      macros: {
-        RR: '{\\bf R}',
-        bold: ['{\\bf #1}', 1],
-      },
-    },
-    svg: {
-      scale: 1.2,
-      fontCache: 'global',
-    },
-    options: {
-      skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
-      ignoreClass: 'MJX_ignore',
-    },
-    loader: {
-      // paths: { mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-chtml.min.js' },
-      load: ['input/tex-full', 'output/svg', 'adapter/liteDOM'],
-    }
-  }
-
-  if (window.MathJax) {
-    window.MathJax.startup.promise.then(() => {
-      const element = document.getElementById('box');
-
-      window.MathJax.typesetPromise();
-
-      window.MathJax.typesetPromise([element])
-        .then(() => {
-          console.log('公式已渲染');
-        })
-        .catch((error) => {
-          console.error('公式渲染失败:', error);
-        });
-    });
-  }
-
-
-}

+ 0 - 1
src/components/index.js

@@ -45,7 +45,6 @@ export {
   SvgIcon,
   ChatWelcome,
 
-
   contactUs,
   userEdit,
   editPassword,

+ 1 - 2
src/views/analyse/WaterView.vue

@@ -13,9 +13,8 @@ import { formatToData } from "@/utils/format";
 
 import { waterApi } from '@/api/water';
 
-
 const { recommendList } = useRecommend({type: 1});
-const { scrollRef, scrollToTop, scrollToBottom, scrollToBottomIfAtBottom } = useScroll();
+const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom } = useScroll();
 const { refetch, cancelFetch } = useFetchStream("/grpc/decisionStream", { methdos: 'POST' }, false);
 const { recordList, isFetching, onScrolltolower, onRestore } = useInfinite('/front/bigModel/warning/pageList', { type: 0, warningStatus: 0 });