Giter VIP home page Giter VIP logo

chathn's Issues

Unhandled Runtime Error โ€” Cannot read properties of undefined (reading 'function_call')

I get this error as soon as I send a message:

Error Cannot read properties of undefined (reading 'function_call')
let finalResponse;
 
>  if (initialResponseMessage.function_call) {
                               ^ (this arrow is at the dot between these words)
  58 |     const { name, arguments: args } = initialResponseMessage.function_call;
  59 |     const functionResponse = await runFunction(name, JSON.parse(args));
Unhandled Runtime Error
Error: <!DOCTYPE html><html><head><meta charSet="utf-8"/><link rel="preload" as="script" 
href="/_next/static/chunks/webpack.js?ts=1691270902524"/><link rel="preload" as="script" 
href="/_next/static/chunks/main.js?ts=1691270902524"/><link rel="preload" as="script" 
href="/_next/static/chunks/pages/_app.js?ts=1691270902524"/><link rel="preload" as="script" 
href="/_next/static/chunks/pages/_error.js?ts=1691270902524"/><link rel="preload" as="script" 
href="/_next/static/development/_buildManifest.js?ts=1691270902524"/><link rel="preload" as="script" 
href="/_next/static/development/_ssgManifest.js?ts=1691270902524"/><link rel="preload" as="script" 
href="/_next/static/chunks/react-refresh.js?ts=1691270902524"/><meta name="viewport" content="width=device-width"/>
<meta name="next-head-count" content="2"/><style data-next-hide-fouc="true">body{display:none}</style><noscript data-
next-hide-fouc="true"><style>body{display:block}</style></noscript><noscript data-n-css=""></noscript><script defer="" 
noModule="" src="/_next/static/chunks/polyfills.js?ts=1691270902524"></script><script src="/_next/static/chunks/webpack.js?
ts=1691270902524" defer=""></script><script src="/_next/static/chunks/main.js?ts=1691270902524" defer=""></script>
<script src="/_next/static/chunks/pages/_app.js?ts=1691270902524" defer=""></script><script 
src="/_next/static/chunks/pages/_error.js?ts=1691270902524" defer=""></script><script 
src="/_next/static/development/_buildManifest.js?ts=1691270902524" defer=""></script><script 
src="/_next/static/development/_ssgManifest.js?ts=1691270902524" defer=""></script><noscript 
id="__next_css__DO_NOT_USE__"></noscript></head><body><div id="__next"></div><script 
src="/_next/static/chunks/react-refresh.js?ts=1691270902524"></script><script id="__NEXT_DATA__" 
type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":
{"__NEXT_PAGE":"/api/chat"},"buildId":"development","isFallback":false,"err":{"name":"TypeError","source":"edge-
server","message":"Cannot read properties of undefined (reading 'function_call')","stack":"TypeError: Cannot read properties of 
undefined (reading 'function_call')\n    at POST (webpack-internal:///(sc_server)/./app/api/chat/route.ts:35:32)\n    at 
process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async eval (webpack-
internal:///(sc_server)/./node_modules/.pnpm/[email protected]_react-
[email protected][email protected]/node_modules/next/dist/esm/server/future/route-modules/app-
route/module.js:229:37)"},"gip":true,"scriptLoader":[]}</script></body></html>

My env file is setup properly and I've tried renaming it to .env.local too but it doesn't work.

`CompletionCreateParams` is deprecated

Screenshot 2023-10-29 at 6 08 26 PM Screenshot 2023-10-29 at 6 09 23 PM Screenshot 2023-10-29 at 6 18 39 PM

On nextjs 13.4.7 (and above), this app will not compile/build successfully when using npm run build, however works in it works when in local dev mode, and works when deploying via one click to Vercel from the (templates)[https://vercel.com/templates] page.

It appears to be related to CompletionCreateParams which is being used/imported in the api/chat/functions.ts file. The linter error states that this has been deprecated and to use ChatCompletionCreateParams instead .. which I tried, and that successfully makes linter errors go away ... however then I get this error at build time:

Screenshot 2023-10-29 at 6 43 05 PM Screenshot 2023-10-29 at 6 41 41 PM

Dark mode styles

The colors don't look right when i have prefers-dark-mode enabled on my device

Here:
image

Possible fix:

  1. darkMode:"class" in tailwind config
  2. Write darkmode tailwind styles with dark:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.