LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。
TypeScript
feat: add Markdown rendering and wiki citations in chat
nash_su2f8cff8ab34c
diff --git a/package-lock.json b/package-lock.jsonindex 0c925a1a..548f7cd5 100644--- a/package-lock.json+++ b/package-lock.json@@ -22,6 +22,7 @@"lucide-react": "^1.7.0","react": "^19.0.0","react-dom": "^19.0.0",+ "react-markdown": "^10.1.0","react-resizable-panels": "^4.9.0","shadcn": "^4.1.2","tailwind-merge": "^3.5.0",@@ -2828,6 +2829,21 @@"@types/ms": "*"}},+ "node_modules/@types/estree": {+ "version": "1.0.8",+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",+ "license": "MIT"+ },+ "node_modules/@types/estree-jsx": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz",+ "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "*"+ }+ },"node_modules/@types/hast": {"version": "3.0.4","resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",@@ -2887,7 +2903,6 @@"version": "19.2.14","resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz","integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",- "devOptional": true,"license": "MIT","dependencies": {"csstype": "^3.2.2"@@ -2928,6 +2943,12 @@"integrity": "sha512-lrpDziQipxCEeK5kWxvljWYhUvOiB2A9izZd9B2AFarYAkqZshb4lPbRs7zKEic6eGtH8V/2qJW+dPp9OtF6bw==","license": "MIT"},+ "node_modules/@ungap/structured-clone": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz",+ "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==",+ "license": "ISC"+ },"node_modules/@vitejs/plugin-react": {"version": "6.0.1","resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.0.1.tgz",@@ -3380,6 +3401,36 @@"url": "https://github.com/sponsors/wooorm"}},+ "node_modules/character-entities-html4": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz",+ "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/character-entities-legacy": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",+ "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/character-reference-invalid": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz",+ "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/class-variance-authority": {"version": "0.7.1","resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz",@@ -3548,6 +3599,16 @@"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==","license": "MIT"},+ "node_modules/comma-separated-tokens": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",+ "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/commander": {"version": "14.0.3","resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",@@ -4048,6 +4109,16 @@"node": ">=4"}},+ "node_modules/estree-util-is-identifier-name": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz",+ "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/estree-walker": {"version": "2.0.2","resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",@@ -4543,6 +4614,46 @@"node": ">= 0.4"}},+ "node_modules/hast-util-to-jsx-runtime": {+ "version": "2.3.6",+ "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz",+ "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0",+ "@types/hast": "^3.0.0",+ "@types/unist": "^3.0.0",+ "comma-separated-tokens": "^2.0.0",+ "devlop": "^1.0.0",+ "estree-util-is-identifier-name": "^3.0.0",+ "hast-util-whitespace": "^3.0.0",+ "mdast-util-mdx-expression": "^2.0.0",+ "mdast-util-mdx-jsx": "^3.0.0",+ "mdast-util-mdxjs-esm": "^2.0.0",+ "property-information": "^7.0.0",+ "space-separated-tokens": "^2.0.0",+ "style-to-js": "^1.0.0",+ "unist-util-position": "^5.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-whitespace": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz",+ "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/headers-polyfill": {"version": "4.0.3","resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-4.0.3.tgz",@@ -4558,6 +4669,16 @@"node": ">=16.9.0"}},+ "node_modules/html-url-attributes": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz",+ "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/http-errors": {"version": "2.0.1","resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",@@ -4647,6 +4768,12 @@"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==","license": "ISC"},+ "node_modules/inline-style-parser": {+ "version": "0.2.7",+ "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz",+ "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==",+ "license": "MIT"+ },"node_modules/ip-address": {"version": "10.1.0","resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz",@@ -4665,12 +4792,46 @@"node": ">= 0.10"}},+ "node_modules/is-alphabetical": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz",+ "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/is-alphanumerical": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz",+ "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==",+ "license": "MIT",+ "dependencies": {+ "is-alphabetical": "^2.0.0",+ "is-decimal": "^2.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/is-arrayish": {"version": "0.2.1","resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz","integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==","license": "MIT"},+ "node_modules/is-decimal": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz",+ "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/is-docker": {"version": "3.0.0","resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",@@ -4716,6 +4877,16 @@"node": ">=0.10.0"}},+ "node_modules/is-hexadecimal": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz",+ "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/is-in-ssh": {"version": "1.0.0","resolved": "https://registry.npmjs.org/is-in-ssh/-/is-in-ssh-1.0.0.tgz",@@ -5507,6 +5678,66 @@"url": "https://opencollective.com/unified"}},+ "node_modules/mdast-util-mdx-expression": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz",+ "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "devlop": "^1.0.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-mdx-jsx": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz",+ "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "@types/unist": "^3.0.0",+ "ccount": "^2.0.0",+ "devlop": "^1.1.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0",+ "parse-entities": "^4.0.0",+ "stringify-entities": "^4.0.0",+ "unist-util-stringify-position": "^4.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/mdast-util-mdxjs-esm": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz",+ "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==",+ "license": "MIT",+ "dependencies": {+ "@types/estree-jsx": "^1.0.0",+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "devlop": "^1.0.0",+ "mdast-util-from-markdown": "^2.0.0",+ "mdast-util-to-markdown": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/mdast-util-phrasing": {"version": "4.1.0","resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz",@@ -5521,6 +5752,27 @@"url": "https://opencollective.com/unified"}},+ "node_modules/mdast-util-to-hast": {+ "version": "13.2.1",+ "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz",+ "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "@ungap/structured-clone": "^1.0.0",+ "devlop": "^1.0.0",+ "micromark-util-sanitize-uri": "^2.0.0",+ "trim-lines": "^3.0.0",+ "unist-util-position": "^5.0.0",+ "unist-util-visit": "^5.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/mdast-util-to-markdown": {"version": "2.1.2","resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz",@@ -6572,6 +6824,31 @@"node": ">=6"}},+ "node_modules/parse-entities": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz",+ "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^2.0.0",+ "character-entities-legacy": "^3.0.0",+ "character-reference-invalid": "^2.0.0",+ "decode-named-character-reference": "^1.0.0",+ "is-alphanumerical": "^2.0.0",+ "is-decimal": "^2.0.0",+ "is-hexadecimal": "^2.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },+ "node_modules/parse-entities/node_modules/@types/unist": {+ "version": "2.0.11",+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz",+ "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==",+ "license": "MIT"+ },"node_modules/parse-json": {"version": "5.2.0","resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",@@ -6749,6 +7026,16 @@"node": ">=6"}},+ "node_modules/property-information": {+ "version": "7.1.0",+ "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz",+ "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/prosemirror-changeset": {"version": "2.4.0","resolved": "https://registry.npmjs.org/prosemirror-changeset/-/prosemirror-changeset-2.4.0.tgz",@@ -7034,6 +7321,33 @@"react": "^19.2.4"}},+ "node_modules/react-markdown": {+ "version": "10.1.0",+ "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz",+ "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "devlop": "^1.0.0",+ "hast-util-to-jsx-runtime": "^2.0.0",+ "html-url-attributes": "^3.0.0",+ "mdast-util-to-hast": "^13.0.0",+ "remark-parse": "^11.0.0",+ "remark-rehype": "^11.0.0",+ "unified": "^11.0.0",+ "unist-util-visit": "^5.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ },+ "peerDependencies": {+ "@types/react": ">=18",+ "react": ">=18"+ }+ },"node_modules/react-resizable-panels": {"version": "4.9.0","resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-4.9.0.tgz",@@ -7141,6 +7455,23 @@"url": "https://opencollective.com/unified"}},+ "node_modules/remark-rehype": {+ "version": "11.1.2",+ "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz",+ "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/mdast": "^4.0.0",+ "mdast-util-to-hast": "^13.0.0",+ "unified": "^11.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/remark-stringify": {"version": "11.0.0","resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz",@@ -7573,6 +7904,16 @@"node": ">=0.10.0"}},+ "node_modules/space-separated-tokens": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",+ "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/statuses": {"version": "2.0.2","resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",@@ -7617,6 +7958,20 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/stringify-entities": {+ "version": "4.0.4",+ "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",+ "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==",+ "license": "MIT",+ "dependencies": {+ "character-entities-html4": "^2.0.0",+ "character-entities-legacy": "^3.0.0"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/stringify-object": {"version": "5.0.0","resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-5.0.0.tgz",@@ -7676,6 +8031,24 @@"integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==","license": "MIT"},+ "node_modules/style-to-js": {+ "version": "1.1.21",+ "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz",+ "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==",+ "license": "MIT",+ "dependencies": {+ "style-to-object": "1.0.14"+ }+ },+ "node_modules/style-to-object": {+ "version": "1.0.14",+ "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz",+ "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==",+ "license": "MIT",+ "dependencies": {+ "inline-style-parser": "0.2.7"+ }+ },"node_modules/tabbable": {"version": "6.4.0","resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.4.0.tgz",@@ -7796,6 +8169,16 @@"node": ">=16"}},+ "node_modules/trim-lines": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",+ "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/trough": {"version": "2.2.0","resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz",@@ -7939,6 +8322,19 @@"url": "https://opencollective.com/unified"}},+ "node_modules/unist-util-position": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz",+ "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/unist-util-remove-position": {"version": "5.0.0","resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-5.0.0.tgz",diff --git a/package.json b/package.jsonindex 9fd27350..a8c9dc35 100644--- a/package.json+++ b/package.json@@ -24,6 +24,7 @@"lucide-react": "^1.7.0","react": "^19.0.0","react-dom": "^19.0.0",+ "react-markdown": "^10.1.0","react-resizable-panels": "^4.9.0","shadcn": "^4.1.2","tailwind-merge": "^3.5.0",diff --git a/src/components/chat/chat-message.tsx b/src/components/chat/chat-message.tsxindex 54053eaa..299d69da 100644--- a/src/components/chat/chat-message.tsx+++ b/src/components/chat/chat-message.tsx@@ -1,4 +1,8 @@-import { Bot, User } from "lucide-react"+import { useCallback } from "react"+import ReactMarkdown from "react-markdown"+import { Bot, User, FileText } from "lucide-react"+import { useWikiStore } from "@/stores/wiki-store"+import { readFile } from "@/commands/fs"import type { DisplayMessage } from "@/stores/chat-store"interface ChatMessageProps {@@ -7,12 +11,17 @@ interface ChatMessageProps {export function ChatMessage({ message }: ChatMessageProps) {const isUser = message.role === "user"+ const isSystem = message.role === "system"return (<div className={`flex gap-2 ${isUser ? "flex-row-reverse" : "flex-row"}`}><divclassName={`flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${- isUser ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"+ isSystem+ ? "bg-accent text-accent-foreground"+ : isUser+ ? "bg-primary text-primary-foreground"+ : "bg-muted text-muted-foreground"}`}>{isUser ? <User className="h-4 w-4" /> : <Bot className="h-4 w-4" />}@@ -24,7 +33,11 @@ export function ChatMessage({ message }: ChatMessageProps) {: "bg-muted text-foreground"}`}>- <p className="whitespace-pre-wrap break-words">{message.content}</p>+ {isUser ? (+ <p className="whitespace-pre-wrap break-words">{message.content}</p>+ ) : (+ <MarkdownContent content={message.content} />+ )}</div></div>)@@ -41,11 +54,98 @@ export function StreamingMessage({ content }: StreamingMessageProps) {<Bot className="h-4 w-4" /></div><div className="max-w-[80%] rounded-lg px-3 py-2 text-sm bg-muted text-foreground">- <p className="whitespace-pre-wrap break-words">- {content}- <span className="animate-pulse">▊</span>- </p>+ <MarkdownContent content={content} />+ <span className="animate-pulse">▊</span></div></div>)}++function MarkdownContent({ content }: { content: string }) {+ // Extract [[wikilinks]] and render them as clickable+ const processed = processWikiLinks(content)++ return (+ <div className="chat-markdown prose prose-sm max-w-none dark:prose-invert prose-p:my-1 prose-headings:my-2 prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-pre:my-2 prose-code:text-xs prose-code:before:content-none prose-code:after:content-none">+ <ReactMarkdown+ components={{+ // Render wiki links embedded as special markers+ a: ({ href, children, ...props }) => {+ if (href?.startsWith("wikilink:")) {+ const pageName = href.slice("wikilink:".length)+ return <WikiLink pageName={pageName}>{children}</WikiLink>+ }+ return <a href={href} {...props} target="_blank" rel="noopener noreferrer">{children}</a>+ },+ // Compact code blocks+ pre: ({ children, ...props }) => (+ <pre className="rounded bg-background/50 p-2 text-xs overflow-x-auto" {...props}>{children}</pre>+ ),+ }}+ >+ {processed}+ </ReactMarkdown>+ </div>+ )+}++/**+ * Convert [[wikilink]] syntax to markdown links that our custom renderer can handle.+ * [[page-name]] → [page-name](wikilink:page-name)+ * [[page-name|display text]] → [display text](wikilink:page-name)+ */+function processWikiLinks(text: string): string {+ return text.replace(+ /\[\[([^\]|]+?)(?:\|([^\]]+?))?\]\]/g,+ (_match, pageName: string, displayText?: string) => {+ const display = displayText?.trim() || pageName.trim()+ return `[${display}](wikilink:${pageName.trim()})`+ }+ )+}++function WikiLink({ pageName, children }: { pageName: string; children: React.ReactNode }) {+ const project = useWikiStore((s) => s.project)+ const setSelectedFile = useWikiStore((s) => s.setSelectedFile)+ const setFileContent = useWikiStore((s) => s.setFileContent)+ const setActiveView = useWikiStore((s) => s.setActiveView)++ const handleClick = useCallback(async () => {+ if (!project) return+ // Try to find the file in common wiki directories+ const candidates = [+ `${project.path}/wiki/entities/${pageName}.md`,+ `${project.path}/wiki/concepts/${pageName}.md`,+ `${project.path}/wiki/sources/${pageName}.md`,+ `${project.path}/wiki/queries/${pageName}.md`,+ `${project.path}/wiki/comparisons/${pageName}.md`,+ `${project.path}/wiki/synthesis/${pageName}.md`,+ `${project.path}/wiki/${pageName}.md`,+ ]++ for (const path of candidates) {+ try {+ const content = await readFile(path)+ setSelectedFile(path)+ setFileContent(content)+ setActiveView("wiki")+ return+ } catch {+ // try next candidate+ }+ }+ // If not found, just set the name+ console.warn(`Wiki page not found: ${pageName}`)+ }, [project, pageName, setSelectedFile, setFileContent, setActiveView])++ return (+ <button+ onClick={handleClick}+ className="inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-primary underline decoration-primary/30 hover:bg-primary/10 hover:decoration-primary"+ title={`Open wiki page: ${pageName}`}+ >+ <FileText className="inline h-3 w-3" />+ {children}+ </button>+ )+}diff --git a/src/components/chat/chat-panel.tsx b/src/components/chat/chat-panel.tsxindex 4ca98744..a2798d7d 100644--- a/src/components/chat/chat-panel.tsx+++ b/src/components/chat/chat-panel.tsx@@ -5,9 +5,9 @@ import { ChatMessage, StreamingMessage } from "./chat-message"import { ChatInput } from "./chat-input"import { useChatStore, chatMessagesToLLM } from "@/stores/chat-store"import { useWikiStore } from "@/stores/wiki-store"-import { streamChat } from "@/lib/llm-client"+import { streamChat, type ChatMessage as LLMMessage } from "@/lib/llm-client"import { executeIngestWrites } from "@/lib/ingest"-import { listDirectory } from "@/commands/fs"+import { listDirectory, readFile } from "@/commands/fs"export function ChatPanel() {const messages = useChatStore((s) => s.messages)@@ -40,8 +40,31 @@ export function ChatPanel() {addMessage("user", text)setStreaming(true)+ // Build system prompt with wiki context+ const systemMessages: LLMMessage[] = []+ if (project) {+ const [index, purpose, schema] = await Promise.all([+ readFile(`${project.path}/wiki/index.md`).catch(() => ""),+ readFile(`${project.path}/purpose.md`).catch(() => ""),+ readFile(`${project.path}/schema.md`).catch(() => ""),+ ])+ systemMessages.push({+ role: "system",+ content: [+ "You are a knowledgeable wiki assistant. Answer questions using the wiki's content.",+ "When you reference wiki pages, use [[wikilink]] syntax (e.g., [[entity-name]], [[concept-name]]).",+ "Always cite which wiki pages your answer draws from.",+ "Use markdown formatting for clarity.",+ "",+ purpose ? `## Wiki Purpose\n${purpose}` : "",+ schema ? `## Wiki Schema\n${schema}` : "",+ index ? `## Wiki Index\n${index}` : "",+ ].filter(Boolean).join("\n"),+ })+ }+const allMessages = useChatStore.getState().messages- const llmMessages = chatMessagesToLLM(allMessages)+ const llmMessages = [...systemMessages, ...chatMessagesToLLM(allMessages)]const controller = new AbortController()abortRef.current = controller