Skip to content

Commit

Permalink
Merge branch 'lobehub:main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
LovelyGuYiMeng authored Sep 19, 2024
2 parents 916dd63 + b4e17c2 commit 8077338
Show file tree
Hide file tree
Showing 33 changed files with 1,197 additions and 174 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ next-env.d.ts
.next
.env
public/*.js
public/sitemap.xml
public/sitemap-index.xml
bun.lockb
sitemap*.xml
robots.txt
Expand Down
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,74 @@

# Changelog

### [Version 1.19.5](https://github.com/lobehub/lobe-chat/compare/v1.19.4...v1.19.5)

<sup>Released on **2024-09-19**</sup>

#### 💄 Styles

- **misc**: Enable functioncall for stepfun models, Update qwen models.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Styles

- **misc**: Enable functioncall for stepfun models, closes [#4022](https://github.com/lobehub/lobe-chat/issues/4022) ([afb3509](https://github.com/lobehub/lobe-chat/commit/afb3509))
- **misc**: Update qwen models, closes [#4026](https://github.com/lobehub/lobe-chat/issues/4026) ([6169e8f](https://github.com/lobehub/lobe-chat/commit/6169e8f))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.19.4](https://github.com/lobehub/lobe-chat/compare/v1.19.3...v1.19.4)

<sup>Released on **2024-09-19**</sup>

#### ♻ Code Refactoring

- **misc**: Refactor the sitemap implement.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

- **misc**: Refactor the sitemap implement, closes [#4012](https://github.com/lobehub/lobe-chat/issues/4012) ([d93a161](https://github.com/lobehub/lobe-chat/commit/d93a161))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.19.3](https://github.com/lobehub/lobe-chat/compare/v1.19.2...v1.19.3)

<sup>Released on **2024-09-19**</sup>

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.19.2](https://github.com/lobehub/lobe-chat/compare/v1.19.1...v1.19.2)

<sup>Released on **2024-09-19**</sup>
Expand Down
42 changes: 22 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
## Base image for all the stages
FROM node:20-alpine AS base
FROM node:20-slim AS base

ARG USE_CN_MIRROR

ENV DEBIAN_FRONTEND="noninteractive"

RUN \
# If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true
if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \
sed -i "s/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g" "/etc/apk/repositories"; \
sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" "/etc/apt/sources.list.d/debian.sources"; \
fi \
# Add required package & update base package
&& apk update \
&& apk add --no-cache bind-tools proxychains-ng sudo \
&& apk upgrade --no-cache \
# Add user nextjs to run the app
&& apt update \
&& apt install busybox proxychains-ng -qy \
&& apt full-upgrade -qy \
&& apt autoremove -qy --purge \
&& apt clean -qy \
# Configure BusyBox
&& busybox --install -s \
# Add nextjs:nodejs to run the app
&& addgroup --system --gid 1001 nodejs \
&& adduser --system --uid 1001 nextjs \
&& chown -R nextjs:nodejs "/etc/proxychains" \
&& echo "nextjs ALL=(ALL) NOPASSWD: /bin/chmod * /etc/resolv.conf" >> /etc/sudoers \
&& rm -rf /tmp/* /var/cache/apk/*
&& adduser --system --home "/app" --gid 1001 -uid 1001 nextjs \
# Set permission for nextjs:nodejs
&& chown -R nextjs:nodejs "/etc/proxychains4.conf" \
# Cleanup temp files
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*

## Builder image, install all the dependencies and build the app
FROM base AS builder
Expand Down Expand Up @@ -89,7 +96,8 @@ FROM base
# Copy all the files from app, set the correct permission for prerender cache
COPY --from=app --chown=nextjs:nodejs /app /app

ENV NODE_ENV="production"
ENV NODE_ENV="production" \
NODE_TLS_REJECT_UNAUTHORIZED=""

# set hostname to localhost
ENV HOSTNAME="0.0.0.0" \
Expand Down Expand Up @@ -121,6 +129,8 @@ ENV \
DEEPSEEK_API_KEY="" \
# Fireworks AI
FIREWORKSAI_API_KEY="" FIREWORKSAI_MODEL_LIST="" \
# GitHub
GITHUB_TOKEN="" GITHUB_MODEL_LIST="" \
# Google
GOOGLE_API_KEY="" GOOGLE_PROXY_URL="" \
# Groq
Expand Down Expand Up @@ -193,15 +203,7 @@ CMD \
'tcp_read_time_out 15000' \
'[ProxyList]' \
"$protocol $host $port" \
> "/etc/proxychains/proxychains.conf"; \
fi; \
# Fix DNS resolving issue in Docker Compose, ref https://github.com/lobehub/lobe-chat/pull/3837
if [ -f "/etc/resolv.conf" ]; then \
sudo chmod 666 "/etc/resolv.conf"; \
resolv_conf=$(grep '^nameserver' "/etc/resolv.conf" | awk '{print "nameserver " $2}'); \
printf "%s\n" \
"$resolv_conf" \
> "/etc/resolv.conf"; \
> "/etc/proxychains4.conf"; \
fi; \
# Run the server
${PROXYCHAINS} node "/app/server.js";
42 changes: 22 additions & 20 deletions Dockerfile.database
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
## Base image for all the stages
FROM node:20-alpine AS base
FROM node:20-slim AS base

ARG USE_CN_MIRROR

ENV DEBIAN_FRONTEND="noninteractive"

RUN \
# If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true
if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \
sed -i "s/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g" "/etc/apk/repositories"; \
sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" "/etc/apt/sources.list.d/debian.sources"; \
fi \
# Add required package & update base package
&& apk update \
&& apk add --no-cache bind-tools proxychains-ng sudo \
&& apk upgrade --no-cache \
# Add user nextjs to run the app
&& apt update \
&& apt install busybox proxychains-ng -qy \
&& apt full-upgrade -qy \
&& apt autoremove -qy --purge \
&& apt clean -qy \
# Configure BusyBox
&& busybox --install -s \
# Add nextjs:nodejs to run the app
&& addgroup --system --gid 1001 nodejs \
&& adduser --system --uid 1001 nextjs \
&& chown -R nextjs:nodejs "/etc/proxychains" \
&& echo "nextjs ALL=(ALL) NOPASSWD: /bin/chmod * /etc/resolv.conf" >> /etc/sudoers \
&& rm -rf /tmp/* /var/cache/apk/*
&& adduser --system --home "/app" --gid 1001 -uid 1001 nextjs \
# Set permission for nextjs:nodejs
&& chown -R nextjs:nodejs "/etc/proxychains4.conf" \
# Cleanup temp files
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*

## Builder image, install all the dependencies and build the app
FROM base AS builder
Expand Down Expand Up @@ -102,7 +109,8 @@ FROM base
# Copy all the files from app, set the correct permission for prerender cache
COPY --from=app --chown=nextjs:nodejs /app /app

ENV NODE_ENV="production"
ENV NODE_ENV="production" \
NODE_TLS_REJECT_UNAUTHORIZED=""

# set hostname to localhost
ENV HOSTNAME="0.0.0.0" \
Expand Down Expand Up @@ -153,6 +161,8 @@ ENV \
DEEPSEEK_API_KEY="" \
# Fireworks AI
FIREWORKSAI_API_KEY="" FIREWORKSAI_MODEL_LIST="" \
# GitHub
GITHUB_TOKEN="" GITHUB_MODEL_LIST="" \
# Google
GOOGLE_API_KEY="" GOOGLE_PROXY_URL="" \
# Groq
Expand Down Expand Up @@ -225,15 +235,7 @@ CMD \
'tcp_read_time_out 15000' \
'[ProxyList]' \
"$protocol $host $port" \
> "/etc/proxychains/proxychains.conf"; \
fi; \
# Fix DNS resolving issue in Docker Compose, ref https://github.com/lobehub/lobe-chat/pull/3837
if [ -f "/etc/resolv.conf" ]; then \
sudo chmod 666 "/etc/resolv.conf"; \
resolv_conf=$(grep '^nameserver' "/etc/resolv.conf" | awk '{print "nameserver " $2}'); \
printf "%s\n" \
"$resolv_conf" \
> "/etc/resolv.conf"; \
> "/etc/proxychains4.conf"; \
fi; \
# Run migration
node "/app/docker.cjs"; \
Expand Down
53 changes: 0 additions & 53 deletions next-sitemap.config.mjs

This file was deleted.

10 changes: 10 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ const nextConfig = {
output: buildWithDocker ? 'standalone' : undefined,
reactStrictMode: true,
redirects: async () => [
{
destination: '/sitemap-index.xml',
permanent: true,
source: '/sitemap.xml',
},
{
destination: '/discover',
permanent: true,
source: '/market',
},
{
destination: '/settings/common',
permanent: true,
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lobehub/chat",
"version": "1.19.2",
"version": "1.19.5",
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
"keywords": [
"framework",
Expand Down Expand Up @@ -29,11 +29,11 @@
"build": "next build",
"postbuild": "npm run build-sitemap && npm run build-migrate-db",
"build-migrate-db": "bun run db:migrate",
"build-sitemap": "next-sitemap --config next-sitemap.config.mjs",
"build-sitemap": "tsx ./scripts/buildSitemapIndex/index.ts",
"build:analyze": "ANALYZE=true next build",
"build:docker": "DOCKER=true next build && npm run build-sitemap",
"db:generate": "drizzle-kit generate",
"db:migrate": "MIGRATION_DB=1 tsx scripts/migrateServerDB/index.ts",
"db:migrate": "MIGRATION_DB=1 tsx ./scripts/migrateServerDB/index.ts",
"db:push": "drizzle-kit push",
"db:push-test": "NODE_ENV=test drizzle-kit push",
"db:studio": "drizzle-kit studio",
Expand Down Expand Up @@ -65,11 +65,11 @@
"test:update": "vitest -u",
"type-check": "tsc --noEmit",
"webhook:ngrok": "ngrok http http://localhost:3011",
"workflow:docs": "tsx scripts/docsWorkflow/index.ts",
"workflow:i18n": "tsx scripts/i18nWorkflow/index.ts",
"workflow:docs": "tsx ./scripts/docsWorkflow/index.ts",
"workflow:i18n": "tsx ./scripts/i18nWorkflow/index.ts",
"workflow:mdx": "tsx ./scripts/mdxWorkflow/index.ts",
"workflow:mdx-with-lint": "tsx ./scripts/mdxWorkflow/index.ts && eslint \"docs/**/*.mdx\" --quiet --fix",
"workflow:readme": "tsx scripts/readmeWorkflow/index.ts"
"workflow:readme": "tsx ./scripts/readmeWorkflow/index.ts"
},
"lint-staged": {
"*.md": [
Expand Down Expand Up @@ -172,7 +172,6 @@
"next": "14.2.8",
"next-auth": "beta",
"next-mdx-remote": "^4.4.1",
"next-sitemap": "^4.2.3",
"nextjs-toploader": "^3.6.15",
"numeral": "^2.0.6",
"nuqs": "^1.17.8",
Expand Down
12 changes: 12 additions & 0 deletions scripts/buildSitemapIndex/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { writeFileSync } from 'node:fs';
import { resolve } from 'node:path';

import { sitemapModule } from '@/server/sitemap';

const genSitemap = () => {
const sitemapIndexXML = sitemapModule.getIndex();
const filename = resolve(__dirname, '../../', 'public', 'sitemap-index.xml');
writeFileSync(filename, sitemapIndexXML);
};

genSitemap();
1 change: 1 addition & 0 deletions src/app/(main)/discover/(detail)/assistant/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const Page = async ({ params, searchParams }: Props) => {
/>
}
/* ↓ cloud slot ↓ */

/* ↑ cloud slot ↑ */
>
<Temp data={data} identifier={identifier} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const ProviderItem = memo<ProviderItemProps>(({ mobile, modelId, identifier }) =
: '--',
},
/* ↓ cloud slot ↓ */

/* ↑ cloud slot ↑ */
];

Expand Down
1 change: 1 addition & 0 deletions src/app/(main)/discover/(detail)/model/[...slugs]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const Page = async ({ params, searchParams }: Props) => {
mobile={mobile}
sidebar={<InfoSidebar data={data} identifier={identifier} mobile={mobile} />}
/* ↓ cloud slot ↓ */

/* ↑ cloud slot ↑ */
>
<ProviderList data={providerData} identifier={identifier} mobile={mobile} />
Expand Down
1 change: 1 addition & 0 deletions src/app/(main)/discover/(detail)/plugin/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const Page = async ({ params, searchParams }: Props) => {
mobile={mobile}
sidebar={<InfoSidebar data={data} identifier={identifier} mobile={mobile} />}
/* ↓ cloud slot ↓ */

/* ↑ cloud slot ↑ */
>
<ParameterList data={data} />
Expand Down
Loading

0 comments on commit 8077338

Please sign in to comment.