diff --git a/.dockerignore b/.dockerignore index 47bd377..cb63db3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -36,7 +36,6 @@ config README.md .gitignore -qodana.yaml screenshot LICENSE diff --git a/adapter/azure/processor.go b/adapter/azure/processor.go index 43c58da..e5a71c4 100644 --- a/adapter/azure/processor.go +++ b/adapter/azure/processor.go @@ -167,13 +167,7 @@ func getRobustnessResult(chunk string) string { matches := compile.FindStringSubmatch(chunk) if len(matches) > 1 { - partial := matches[1] - // if the unicode character is in the string, like `hi\\u2019s`, we need to convert it to `hi's` - if utils.ContainUnicode(partial) { - partial = utils.DecodeUnicode(partial) - } - - return partial + return utils.ProcessRobustnessChar(matches[1]) } else { return "" } diff --git a/adapter/chatgpt/processor.go b/adapter/chatgpt/processor.go index 00c86fe..a2459c9 100644 --- a/adapter/chatgpt/processor.go +++ b/adapter/chatgpt/processor.go @@ -167,13 +167,7 @@ func getRobustnessResult(chunk string) string { matches := compile.FindStringSubmatch(chunk) if len(matches) > 1 { - partial := matches[1] - // if the unicode character is in the string, like `hi\\u2019s`, we need to convert it to `hi's` - if utils.ContainUnicode(partial) { - partial = utils.DecodeUnicode(partial) - } - - return partial + return utils.ProcessRobustnessChar(matches[1]) } else { return "" } diff --git a/adapter/oneapi/processor.go b/adapter/oneapi/processor.go index ada7c1e..64e4bf4 100644 --- a/adapter/oneapi/processor.go +++ b/adapter/oneapi/processor.go @@ -90,13 +90,7 @@ func getRobustnessResult(chunk string) string { matches := compile.FindStringSubmatch(chunk) if len(matches) > 1 { - partial := matches[1] - // if the unicode character is in the string, like `hi\\u2019s`, we need to convert it to `hi's` - if utils.ContainUnicode(partial) { - partial = utils.DecodeUnicode(partial) - } - - return partial + return utils.ProcessRobustnessChar(matches[1]) } else { return "" } diff --git a/admin/user.go b/admin/user.go index df8c646..7c1062d 100644 --- a/admin/user.go +++ b/admin/user.go @@ -127,6 +127,6 @@ func UpdateRootPassword(db *sql.DB, cache *redis.Client, password string) error } cache.Del(context.Background(), fmt.Sprint("nio:user:root")) - + return nil } diff --git a/app/package.json b/app/package.json index b2afd79..4370d29 100644 --- a/app/package.json +++ b/app/package.json @@ -41,6 +41,7 @@ "lucide-react": "^0.289.0", "match-sorter": "^6.3.1", "react": "^18.2.0", + "react-beautiful-dnd": "^13.1.1", "react-chartjs-2": "^5.2.0", "react-dom": "^18.2.0", "react-i18next": "^13.2.2", diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index b51dae2..7b09c87 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -92,6 +92,9 @@ dependencies: react: specifier: ^18.2.0 version: 18.2.0 + react-beautiful-dnd: + specifier: ^13.1.1 + version: 13.1.1(react-dom@18.2.0)(react@18.2.0) react-chartjs-2: specifier: ^5.2.0 version: 5.2.0(chart.js@4.4.0)(react@18.2.0) @@ -2054,6 +2057,15 @@ packages: dependencies: '@types/react': 18.2.33 + /@types/react-redux@7.1.33: + resolution: {integrity: sha512-NF8m5AjWCkert+fosDsN3hAlHzpjSiXlVy9EgQEmLoBhaNXbmyeGs/aj5dQzKuF+/q+S7JQagorGDW8pJ28Hmg==} + dependencies: + '@types/hoist-non-react-statics': 3.3.4 + '@types/react': 18.2.33 + hoist-non-react-statics: 3.3.2 + redux: 4.2.1 + dev: false + /@types/react-syntax-highlighter@15.5.9: resolution: {integrity: sha512-ven8zRSVMNkqt8ySJ2eEW5ugbfl/V/Z9S1c9UNhGqwkwVZNV5akk10rYDALxgwS25cLmN+/Q5UxlGj9CJmZ6Ew==} dependencies: @@ -2697,6 +2709,12 @@ packages: which: 2.0.2 dev: true + /css-box-model@1.2.1: + resolution: {integrity: sha512-a7Vr4Q/kd/aw96bnJG332W9V9LkJO69JRcaCYDUqjp6/z0w6VcZjgAcTbgFxEPfBgdnAwlh3iwu+hLopa+flJw==} + dependencies: + tiny-invariant: 1.3.1 + dev: false + /css-select@4.3.0: resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==} dependencies: @@ -3893,6 +3911,10 @@ packages: '@types/mdast': 3.0.14 dev: false + /memoize-one@5.2.1: + resolution: {integrity: sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==} + dev: false + /merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} dev: true @@ -4533,12 +4555,35 @@ packages: /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + /raf-schd@4.0.3: + resolution: {integrity: sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ==} + dev: false + /randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} dependencies: safe-buffer: 5.2.1 dev: true + /react-beautiful-dnd@13.1.1(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-0Lvs4tq2VcrEjEgDXHjT98r+63drkKEgqyxdA7qD3mvKwga6a5SscbdLPO2IExotU1jW8L0Ksdl0Cj2AF67nPQ==} + peerDependencies: + react: ^16.8.5 || ^17.0.0 || ^18.0.0 + react-dom: ^16.8.5 || ^17.0.0 || ^18.0.0 + dependencies: + '@babel/runtime': 7.23.2 + css-box-model: 1.2.1 + memoize-one: 5.2.1 + raf-schd: 4.0.3 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + react-redux: 7.2.9(react-dom@18.2.0)(react@18.2.0) + redux: 4.2.1 + use-memo-one: 1.1.3(react@18.2.0) + transitivePeerDependencies: + - react-native + dev: false + /react-chartjs-2@5.2.0(chart.js@4.4.0)(react@18.2.0): resolution: {integrity: sha512-98iN5aguJyVSxp5U3CblRLH67J8gkfyGNbiK3c+l1QI/G4irHMPQw44aEPmjVag+YKTyQ260NcF82GTQ3bdscA==} peerDependencies: @@ -4583,6 +4628,10 @@ packages: resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} dev: false + /react-is@17.0.2: + resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} + dev: false + /react-is@18.2.0: resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==} dev: false @@ -4614,6 +4663,28 @@ packages: - supports-color dev: false + /react-redux@7.2.9(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ==} + peerDependencies: + react: ^16.8.3 || ^17 || ^18 + react-dom: '*' + react-native: '*' + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + dependencies: + '@babel/runtime': 7.23.2 + '@types/react-redux': 7.1.33 + hoist-non-react-statics: 3.3.2 + loose-envify: 1.4.0 + prop-types: 15.8.1 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + react-is: 17.0.2 + dev: false + /react-redux@8.1.3(@types/react-dom@18.2.14)(@types/react@18.2.33)(react-dom@18.2.0)(react@18.2.0)(redux@4.2.1): resolution: {integrity: sha512-n0ZrutD7DaX/j9VscF+uTALI3oUPa/pO4Z3soOBIjuRn/FzVu6aehhysxZCLi6y7duMf52WNZGMl7CtuK5EnRw==} peerDependencies: @@ -5170,6 +5241,10 @@ packages: dependencies: any-promise: 1.3.0 + /tiny-invariant@1.3.1: + resolution: {integrity: sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==} + dev: false + /to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -5352,6 +5427,14 @@ packages: tslib: 2.6.2 dev: false + /use-memo-one@1.1.3(react@18.2.0): + resolution: {integrity: sha512-g66/K7ZQGYrI6dy8GLpVcMsBp4s17xNkYJVSMvTEevGy3nDxHOfE6z8BVE22+5G5x7t3+bhzrlTDB7ObrEE0cQ==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + dependencies: + react: 18.2.0 + dev: false + /use-sidecar@1.1.2(@types/react@18.2.33)(react@18.2.0): resolution: {integrity: sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw==} engines: {node: '>=10'} diff --git a/app/src/assets/pages/home.less b/app/src/assets/pages/home.less index 878e1e5..55b0c56 100644 --- a/app/src/assets/pages/home.less +++ b/app/src/assets/pages/home.less @@ -88,7 +88,7 @@ border: 1px solid hsl(var(--border-hover)); border-radius: var(--radius); transition: 0.25s; - cursor: pointer; + cursor: grab; animation: fadein 0.25s forwards ease-in-out; opacity: 0; width: 100%; diff --git a/qodana.yaml b/qodana.yaml deleted file mode 100644 index 215d808..0000000 --- a/qodana.yaml +++ /dev/null @@ -1,29 +0,0 @@ -#-------------------------------------------------------------------------------# -# Qodana analysis is configured by qodana.yaml file # -# https://www.jetbrains.com/help/qodana/qodana-yaml.html # -#-------------------------------------------------------------------------------# -version: "1.0" - -#Specify inspection profile for code analysis -profile: - name: qodana.starter - -#Enable inspections -#include: -# - name: - -#Disable inspections -#exclude: -# - name: -# paths: -# - - -#Execute shell command before Qodana execution (Applied in CI/CD pipeline) -#bootstrap: sh ./prepare-qodana.sh - -#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline) -#plugins: -# - id: #(plugin id can be found at https://plugins.jetbrains.com) - -#Specify Qodana linter for analysis (Applied in CI/CD pipeline) -linter: jetbrains/qodana-go:latest diff --git a/utils/char.go b/utils/char.go index 57ab51e..25c3a93 100644 --- a/utils/char.go +++ b/utils/char.go @@ -190,6 +190,34 @@ func DecodeUnicode(data string) string { }) } +func EscapeChar(data string) string { + // like `\\n` => `\n`, `\\t` => `\t` and so on + re := regexp.MustCompile(`\\([nrtvfb])`) + + mapper := map[string]string{ + "n": "\n", + "r": "\r", + "t": "\t", + "v": "\v", + "f": "\f", + "b": "\b", + } + + return re.ReplaceAllStringFunc(data, func(s string) string { + return mapper[s[1:]] + }) +} + +func ProcessRobustnessChar(data string) string { + // like `hi\\u2019s` => `hi's` + if ContainUnicode(data) { + data = DecodeUnicode(data) + } + + // like `\\n` => `\n`, `\\t` => `\t` and so on + return EscapeChar(data) +} + func SortString(arr []string) []string { // sort string array by first char // e.g. ["a", "b", "c", "ab", "ac", "bc"] => ["a", "ab", "ac", "b", "bc", "c"]