Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # Dify Frontend
  2. This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
  3. ## Getting Started
  4. ### Run by source code
  5. To start the web frontend service, you will need [Node.js v18.x (LTS)](https://nodejs.org/en) and [NPM version 8.x.x](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com/).
  6. First, install the dependencies:
  7. ```bash
  8. npm install
  9. # or
  10. yarn install --frozen-lockfile
  11. ```
  12. Then, configure the environment variables. Create a file named `.env.local` in the current directory and copy the contents from `.env.example`. Modify the values of these environment variables according to your requirements:
  13. ```
  14. # For production release, change this to PRODUCTION
  15. NEXT_PUBLIC_DEPLOY_ENV=DEVELOPMENT
  16. # The deployment edition, SELF_HOSTED
  17. NEXT_PUBLIC_EDITION=SELF_HOSTED
  18. # The base URL of console application, refers to the Console base URL of WEB service if console domain is
  19. # different from api or web app domain.
  20. # example: http://cloud.dify.ai/console/api
  21. NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api
  22. # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from
  23. # console or api domain.
  24. # example: http://udify.app/api
  25. NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api
  26. # SENTRY
  27. NEXT_PUBLIC_SENTRY_DSN=
  28. ```
  29. Finally, run the development server:
  30. ```bash
  31. npm run dev
  32. # or
  33. yarn dev
  34. ```
  35. Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
  36. You can start editing the file under folder `app`. The page auto-updates as you edit the file.
  37. ## Deploy
  38. ### Deploy on server
  39. First, build the app for production:
  40. ```bash
  41. npm run build
  42. ```
  43. Then, start the server:
  44. ```bash
  45. npm run start
  46. ```
  47. If you want to customize the host and port:
  48. ```bash
  49. npm run start --port=3001 --host=0.0.0.0
  50. ```
  51. ## Lint Code
  52. If your IDE is VSCode, rename `web/.vscode/settings.example.json` to `web/.vscode/settings.json` for lint code setting.
  53. ## Test
  54. We start to use [Jest](https://jestjs.io/) and [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) for Unit Testing.
  55. You can create a test file with a suffix of `.spec` beside the file that to be tested. For example, if you want to test a file named `util.ts`. The test file name should be `util.spec.ts`.
  56. Run test:
  57. ```bash
  58. npm run test
  59. ```
  60. If you are not familiar with writing tests, here is some code to refer to:
  61. * [classnames.spec.ts](./utils/classnames.spec.ts)
  62. * [index.spec.tsx](./app/components/base/button/index.spec.tsx)
  63. ## Documentation
  64. Visit <https://docs.dify.ai/getting-started/readme> to view the full documentation.
  65. ## Community
  66. The Dify community can be found on [Discord community](https://discord.gg/5AEfbxcd9k), where you can ask questions, voice ideas, and share your projects.