TypeError: Cannot read properties of undefined (reading 'special') (on local machine)

#101
by RobertoDonPedro - opened

When running the chat-ui locally and entering something in the prompt I get the following errors:

In the inspector tab of the browser:
+page.svelte:151 TypeError: Cannot read properties of undefined (reading 'special')
at getTextGenerationStream (+page.svelte:91:20)
at async writeMessage (+page.svelte:131:43)

In the VSCode terminaI:
Error: Could not parse generated text
at parseGeneratedText (/src/routes/conversation/[id]/+server.ts:160:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async saveMessage (/src/routes/conversation/[id]/+server.ts:86:26)

BTW @coyotte508 I cannot respond or close my other discussions, since limited to 1 message per 24 hours (what kind of sucks :-))

Hugging Chat org

Oh, gotcha @RobertoDonPedro , the rate limit was removed from your account

Please, please, me too.
Since 3 days the same error. Native Debian 11/ WSL: Debian 10, Debian 11, Ubuntu / Docker / Windows 11. MongoDB local and in the cloud... :-/
In my opinion, since ChatGPT, HuggingChat is a revolution, (still) for geeks and people who want to host it (partially) locally and for whom pricacy is important. So I'm not giving up. :-)
This UI is "simple" and good... I've already wasted a lot of time on crafting solutions that could only partially get something out of the LLMs - if I then got it to work at all (with a normal gaming PC)

Hugging Chat org

@RobertoDonPedro @Diotrihhi I updated the default config, setting PUBLIC_MAX_INPUT_TOKENS=1000 instead of PUBLIC_MAX_INPUT_TOKENS=1024

It seems it was the problem with the default model.

I'll also push another commit once I find how to send a better error message

Great @coyotte508 I updated my .env.local with PUBLIC_MAX_INPUT_TOKENS=1000 and stop/start and it works like a charm.

But I'm wondering why there are multiple entries in the .env file regarding the model?
The MODEL_ENDPOINTS define the model that is used through the API, right? Why do we need the PUBLIC_MODEL_NAME, PUBLIC_MODEL_ID then?

Hugging Chat org
โ€ข
edited Apr 30, 2023

PUBLIC_MODEL_NAME is different from PUBLIC_MODEL_ID, one is the name of the model the other the id of the model on hf.co

Regarding MODEL_ENDPOINTS, we currently load balance calls between several APIs. But ideally we'd only use PUBLIC_MODEL_ID (and HF_ACCESS_TOKEN). Maybe that's what we'll end up doing when we add model selection through the UI.

Well, with dynamic model selection in the UI, maybe we don't need a PUBLIC_MODEL_ID (and PUBLIC_MODEL_NAME) at all, and just determine the models by the MODEL_ENDPOINTS.

I still get the following error:

Linux bash:
17:32:28 [vite-plugin-svelte] /src/lib/components/chat/ChatInput.svelte:38:2 A11y: Avoid using autofocus
Could not parse in last message
SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at parseGeneratedText (/src/routes/conversation/[id]/+server.ts:161:32)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async saveMessage (/src/routes/conversation/[id]/+server.ts:89:26)

Chrome console:
Server does not support event stream content type, it returned + response.headers.get("content-type")](age.svelte:152 Error: Task not found for this model
at streamingRequest (index.mjs:210:15)
at async textGenerationStream (index.mjs:467:3)
at async getTextGenerationStream (+page.svelte:59:20)
at async writeMessage (+page.svelte:132:43)

Hugging Chat org

Try getting the updated code, then:

  • npm install
  • clear .env.local, and just specify MONGODB_URL and HF_ACCESS_TOKEN

It should be simpler to configure now

Many thanks for your feedback and improvements, but now:

(chat-ui) debian@GamingPC:/apps/chat-ui$ npm run dev

[email protected] dev
vite dev

โ–ฒ [WARNING] Cannot find base config file "./.svelte-kit/tsconfig.json" [tsconfig.json]

tsconfig.json:2:12:
  2 โ”‚   "extends": "./.svelte-kit/tsconfig.json",
    โ•ต              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(node:332) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use node --trace-warnings ... to show where the warning was created)
(node:332) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
error when starting dev server:
Error: Unexpected option config.kit.csrf.enabled
at file:///apps/chat-ui/node_modules/@sveltejs/kit/src/core/config/options.js:295:12
at file:///apps/chat-ui/node_modules/@sveltejs/kit/src/core/config/options.js:302:18
at file:///apps/chat-ui/node_modules/@sveltejs/kit/src/core/config/options.js:302:18
at validate_config (file:///apps/chat-ui/node_modules/@sveltejs/kit/src/core/config/index.js:108:9)
at process_config (file:///apps/chat-ui/node_modules/@sveltejs/kit/src/core/config/index.js:80:20)
at load_config (file:///apps/chat-ui/node_modules/@sveltejs/kit/src/core/config/index.js:72:9)
at async sveltekit (file:///apps/chat-ui/node_modules/@sveltejs/kit/src/exports/vite/index.js:116:24)
at async Promise.all (index 0)
at async asyncFlatten (file:///apps/chat-ui/node_modules/vite/dist/node/chunks/dep-79892de8.js:12404:16)
at async resolveConfig (file:///apps/chat-ui/node_modules/vite/dist/node/chunks/dep-79892de8.js:63495:29

/edit:
Tried with Node.js v18.16 & v20.1
Copied folder ".svelte-kit" from old chat-ui build to new one
Tried with creating conda environment "chat-ui"
Python 3.10.10 & Python 3.11.3
Debian 11 & Ubuntu 22.04

Hugging Chat org

yes it was a temp error, should be fixed

yes it was a temp error, should be fixed

Now chat-ui starts up to "URL..."
but a few milliseconds later:


VITE v4.2.1 ready in 481 ms

โžœ Local: http://localhost:5173/
โžœ Network: use --host to expose
โžœ press h to show help
20:33:40 [vite] Error when evaluating SSR module /src/lib/server/models.ts:

20:33:40 [vite] Error when evaluating SSR module /src/routes/+layout.server.ts:

Internal server error: Expected double-quoted property name in JSON at position 1602
at JSON.parse ()
at eval (/src/lib/server/models.ts:39:14)
at async instantiateModule (file:///apps/chat-ui/node_modules/vite/dist/node/chunks/dep-79892de8.js:53996:9)
Internal server error: Expected double-quoted property name in JSON at position 1602


39:14 in models.ts starts (in bold):
stop: z.array(z.string()).optional(),


Tested with Debian 11 & Ubuntu 22.04 + 23.04
Also tried with docker this time.

![screenshot.png]({"error":"Only PNG, JPG, JPEG, GIF, MP4, MOV, QT, WEBM, MP3, MPGA, WAV files are supported"})

Hugging Chat org

There was an extra comma, try again?

There was an extra comma, try again?

After many days it works for the 1st time! You are my hero :-)

Hugging Chat org

finally ^^

at least now you have two models to play with :)

coyotte508 changed discussion status to closed

Sign up or log in to comment