huggingface / chat-ui

Open source codebase powering the HuggingChat app
https://huggingface.co/chat
Apache License 2.0
7.34k stars 1.07k forks source link

Error when building chat UI space with default config HF #556

Open lccnl opened 10 months ago

lccnl commented 10 months ago

Hello, I have a space that used to work until yesterday, it is created with the standard chat-ui docker image. Since today when it is built, I have the following error:

--> RUN npm run build

> chat-ui@0.6.0 build
> vite build

vite v4.3.9 building SSR bundle for production...
transforming...
"BaseClient" and "TokenSet" are imported from external module "openid-client" but never used in "src/lib/server/auth.ts".
✓ 199 modules transformed.
rendering chunks...

node:internal/event_target:1036
  process.nextTick(() => { throw err; });
                           ^
Error [ZodError]: [
  {
    "code": "invalid_union_discriminator",
    "options": [
      "aws",
      "openai",
      "tgi",
      "llamacpp"
    ],
    "path": [
      0,
      "endpoints",
      0,
      "type"
    ],
    "message": "Invalid discriminator value. Expected 'aws' | 'openai' | 'tgi' | 'llamacpp'"
  }
]
    at get error [as error] (file:///app/chat-ui/node_modules/zod/lib/index.mjs:538:31)
    at ZodArray.parse (file:///app/chat-ui/node_modules/zod/lib/index.mjs:638:22)
    at file:///app/chat-ui/.svelte-kit/output/server/chunks/models.js:386:40
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:309:10)
    at [kOnMessage] (node:internal/worker:320:37)
    at MessagePort.<anonymous> (node:internal/worker:216:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:761:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28) {
  issues: [
    {
      code: 'invalid_union_discriminator',
      options: [ 'aws', 'openai', 'tgi', 'llamacpp' ],
      path: [ 0, 'endpoints', 0, 'type' ],
      message: "Invalid discriminator value. Expected 'aws' | 'openai' | 'tgi' | 'llamacpp'"
    }
  ],
  [errors]: [
    {
      code: 'invalid_union_discriminator',
      options: [ 'aws', 'openai', 'tgi', 'llamacpp' ],
      path: [ 0, 'endpoints', 0, 'type' ],
      message: "Invalid discriminator value. Expected 'aws' | 'openai' | 'tgi' | 'llamacpp'"
    }
  ]
}

Any clue? Thanks!

nsarrazin commented 10 months ago

Hi! i broke backwards compatibility with the latest change by accident, working on a fix.

If you want a quickfix for your space, feel free to look at this PR for a similar fix. (just add 'type' : 'tgi' in your endpoint definition)

lccnl commented 10 months ago

ok thanks!