@lobehub/chat 0.150.0 → 0.150.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +3 -3
- package/README.zh-CN.md +8 -8
- package/package.json +6 -2
- package/src/app/trpc/[trpc]/route.ts +28 -0
- package/src/libs/logger/index.ts +5 -0
- package/src/libs/trpc/client.ts +13 -0
- package/src/libs/trpc/index.ts +66 -0
- package/src/server/context.ts +28 -0
- package/src/server/routers/index.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.150.1](https://github.com/lobehub/lobe-chat/compare/v0.150.0...v0.150.1)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-04-27**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix display error when using DEFAULT_AGENT_CONFIG env.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix display error when using DEFAULT_AGENT_CONFIG env ([e46215c](https://github.com/lobehub/lobe-chat/commit/e46215c))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
## [Version 0.150.0](https://github.com/lobehub/lobe-chat/compare/v0.149.6...v0.150.0)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2024-04-26**</sup>
|
package/README.md
CHANGED
|
@@ -262,12 +262,12 @@ Our marketplace is not just a showcase platform but also a collaborative space.
|
|
|
262
262
|
|
|
263
263
|
| Recent Submits | Description |
|
|
264
264
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
265
|
+
| [Jailbreak Assistant DAN](https://chat-preview.lobehub.com/market?agent=gpt-4-dan-assistant)<br/><sup>By **[MapleEve](https://github.com/MapleEve)** on **2024-04-26**</sup> | Bypass OpenAI review mechanism, ChatGPT after jailbreak<br/>`creative` `artificial-intelligence` `conversation` `jailbreak` |
|
|
266
|
+
| [TailwindHelper](https://chat-preview.lobehub.com/market?agent=tailwind-helper)<br/><sup>By **[aototo](https://github.com/aototo)** on **2024-04-26**</sup> | TailwindHelper is a professional frontend designer with a solid foundation in design theory and rich practical experience. Created by a leading software development company, it aims to help developers and designers accelerate the development process of web interfaces. TailwindHelper is proficient in the Tailwind CSS framework and can translate complex design requirements into efficient and responsive CSS class names.<br/>`tailwindcss` `css` `tailwind-helper` |
|
|
265
267
|
| [yapi JSON-SCHEMA to Typescript](https://chat-preview.lobehub.com/market?agent=yapi-ts-helper)<br/><sup>By **[zcf0508](https://github.com/zcf0508)** on **2024-04-26**</sup> | Specializes in converting JSON schema to TypeScript types.<br/>`typescript` `development` |
|
|
266
268
|
| [Chinese Academic Paper Editor](https://chat-preview.lobehub.com/market?agent=chinese-paper-polishing)<br/><sup>By **[y22emc2](https://github.com/y22emc2)** on **2024-04-15**</sup> | As an assistant for improving Chinese academic paper writing, your task is to enhance the provided text in terms of spelling, grammar, clarity, conciseness, and overall readability, to improve the text's academic standards and literary quality. This includes breaking down long sentences, reducing repetition, and providing improvement suggestions. Please provide the corrected version of the text first, then list the modifications in the markdown table below, along with the reasons for the changes.<br/>`academic-paper-writing` `proofreading` `text-editing` |
|
|
267
|
-
| [Biology Professor](https://chat-preview.lobehub.com/market?agent=bio-professor)<br/><sup>By **[luxiangze](https://github.com/luxiangze)** on **2024-04-13**</sup> | As a biology professor, you will receive questions and concepts about biology. Please explain these questions and concepts in specific and concise language, and try to use practical examples to illustrate them to help your audience better understand. Please ensure that your explanations are accurate and clear, and try to encourage creative and flexible answers. Respond in Chinese.<br/>`biology` |
|
|
268
|
-
| [Master of Fortune Telling](https://chat-preview.lobehub.com/market?agent=fortune-teller)<br/><sup>By **[kamilkenrich](https://github.com/kamilkenrich)** on **2024-04-13**</sup> | Specializes in numerology, divination, astrology, and blood type analysis<br/>`numerology` `divination` `astrology` `psychology` `blood-type` `constellation` |
|
|
269
269
|
|
|
270
|
-
> 📊 Total agents: [<kbd>**
|
|
270
|
+
> 📊 Total agents: [<kbd>**243**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
|
271
271
|
|
|
272
272
|
<!-- AGENT LIST -->
|
|
273
273
|
|
package/README.zh-CN.md
CHANGED
|
@@ -248,14 +248,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
|
|
|
248
248
|
|
|
249
249
|
<!-- AGENT LIST -->
|
|
250
250
|
|
|
251
|
-
| 最近新增 | 助手说明
|
|
252
|
-
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
253
|
-
| [
|
|
254
|
-
| [
|
|
255
|
-
| [
|
|
256
|
-
| [
|
|
257
|
-
|
|
258
|
-
> 📊 Total agents: [<kbd>**
|
|
251
|
+
| 最近新增 | 助手说明 |
|
|
252
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
253
|
+
| [越狱助手 DAN](https://chat-preview.lobehub.com/market?agent=gpt-4-dan-assistant)<br/><sup>By **[MapleEve](https://github.com/MapleEve)** on **2024-04-26**</sup> | 突破 OpenAI 审核机制,越狱之后的 ChatGPT<br/>`创意` `人工智能` `对话` `越狱` |
|
|
254
|
+
| [TailwindHelper](https://chat-preview.lobehub.com/market?agent=tailwind-helper)<br/><sup>By **[aototo](https://github.com/aototo)** on **2024-04-26**</sup> | TailwindHelper 是一位专业的前端设计师,拥有深厚的设计理论基础和丰富的实践经验。它由一家领先的软件开发公司创建,旨在帮助开发者和设计师加速 Web 界面的开发过程。TailwindHelper 精通 Tailwind CSS 框架,并能够理解复杂的设计要求,转化为高效且响应式的 CSS 类名。<br/>`tailwindcss` `css` `tailwind-helper` |
|
|
255
|
+
| [yapi JSON-SCHEMA to Typescript](https://chat-preview.lobehub.com/market?agent=yapi-ts-helper)<br/><sup>By **[zcf0508](https://github.com/zcf0508)** on **2024-04-26**</sup> | 擅长将 JSON schema 转换为 TypeScript 类型。<br/>`typescript` `开发` |
|
|
256
|
+
| [中文论文编辑师](https://chat-preview.lobehub.com/market?agent=chinese-paper-polishing)<br/><sup>By **[y22emc2](https://github.com/y22emc2)** on **2024-04-15**</sup> | 作为一名中文学术论文写作改进助理,你的任务是改进所提供文本的拼写、语法、清晰、简洁和整体可读性,提高文本的学术规范性、文学性,同时分解长句,减少重复,并提供改进建议。请先提供文本的更正版本,然后在 markdown 表格中列出修改的内容,并给出修改的理由。<br/>`学术论文写作` `校对` `文本编辑` |
|
|
257
|
+
|
|
258
|
+
> 📊 Total agents: [<kbd>**243**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
|
259
259
|
|
|
260
260
|
<!-- AGENT LIST -->
|
|
261
261
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.150.
|
|
3
|
+
"version": "0.150.1",
|
|
4
4
|
"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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@ant-design/icons": "^5.3.6",
|
|
84
84
|
"@anthropic-ai/sdk": "^0.18.0",
|
|
85
|
-
"@auth/core": "0.28.0",
|
|
86
85
|
"@aws-sdk/client-bedrock-runtime": "^3.556.0",
|
|
87
86
|
"@azure/openai": "^1.0.0-beta.12",
|
|
88
87
|
"@cfworker/json-schema": "^1.12.8",
|
|
@@ -96,6 +95,9 @@
|
|
|
96
95
|
"@next/third-parties": "^14.2.2",
|
|
97
96
|
"@sentry/nextjs": "^7.111.0",
|
|
98
97
|
"@t3-oss/env-nextjs": "^0.10.1",
|
|
98
|
+
"@trpc/client": "next",
|
|
99
|
+
"@trpc/next": "next",
|
|
100
|
+
"@trpc/server": "next",
|
|
99
101
|
"@vercel/analytics": "^1.2.2",
|
|
100
102
|
"@vercel/speed-insights": "^1.0.10",
|
|
101
103
|
"ahooks": "^3.7.11",
|
|
@@ -129,6 +131,7 @@
|
|
|
129
131
|
"nuqs": "^1.17.1",
|
|
130
132
|
"ollama": "^0.5.0",
|
|
131
133
|
"openai": "^4.38.2",
|
|
134
|
+
"pino": "^8.20.0",
|
|
132
135
|
"polished": "^4.3.1",
|
|
133
136
|
"posthog-js": "^1.128.1",
|
|
134
137
|
"query-string": "^9.0.0",
|
|
@@ -147,6 +150,7 @@
|
|
|
147
150
|
"rtl-detect": "^1.1.2",
|
|
148
151
|
"semver": "^7.6.0",
|
|
149
152
|
"sharp": "^0.33.3",
|
|
153
|
+
"superjson": "^2.2.1",
|
|
150
154
|
"swr": "^2.2.5",
|
|
151
155
|
"systemjs": "^6.14.3",
|
|
152
156
|
"ts-md5": "^1.3.1",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
|
|
2
|
+
import type { NextRequest } from 'next/server';
|
|
3
|
+
|
|
4
|
+
import { pino } from '@/libs/logger';
|
|
5
|
+
import { createContext } from '@/server/context';
|
|
6
|
+
import { appRouter } from '@/server/routers';
|
|
7
|
+
|
|
8
|
+
export const runtime = 'edge';
|
|
9
|
+
|
|
10
|
+
const handler = (req: NextRequest) =>
|
|
11
|
+
fetchRequestHandler({
|
|
12
|
+
/**
|
|
13
|
+
* @link https://trpc.io/docs/v11/context
|
|
14
|
+
*/
|
|
15
|
+
createContext: () => createContext(req),
|
|
16
|
+
|
|
17
|
+
endpoint: '/trpc',
|
|
18
|
+
|
|
19
|
+
onError: ({ error, path }) => {
|
|
20
|
+
pino.info(`Error in tRPC handler (edge) on path: ${path}`);
|
|
21
|
+
pino.error(error);
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
req,
|
|
25
|
+
router: appRouter,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export { handler as GET, handler as POST };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createTRPCClient, httpBatchLink } from '@trpc/client';
|
|
2
|
+
import superjson from 'superjson';
|
|
3
|
+
|
|
4
|
+
import type { AppRouter } from '@/server/routers';
|
|
5
|
+
|
|
6
|
+
export const trpcClient = createTRPCClient<AppRouter>({
|
|
7
|
+
links: [
|
|
8
|
+
httpBatchLink({
|
|
9
|
+
transformer: superjson,
|
|
10
|
+
url: '/trpc',
|
|
11
|
+
}),
|
|
12
|
+
],
|
|
13
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is your entry point to setup the root configuration for tRPC on the server.
|
|
3
|
+
* - `initTRPC` should only be used once per app.
|
|
4
|
+
* - We export only the functionality that we use so we can enforce which base procedures should be used
|
|
5
|
+
*
|
|
6
|
+
* Learn how to create protected base procedures and other things below:
|
|
7
|
+
* @link https://trpc.io/docs/v11/router
|
|
8
|
+
* @link https://trpc.io/docs/v11/procedures
|
|
9
|
+
*/
|
|
10
|
+
import { TRPCError, initTRPC } from '@trpc/server';
|
|
11
|
+
import superjson from 'superjson';
|
|
12
|
+
|
|
13
|
+
import type { Context } from '@/server/context';
|
|
14
|
+
|
|
15
|
+
const t = initTRPC.context<Context>().create({
|
|
16
|
+
/**
|
|
17
|
+
* @link https://trpc.io/docs/v11/error-formatting
|
|
18
|
+
*/
|
|
19
|
+
errorFormatter({ shape }) {
|
|
20
|
+
return shape;
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* @link https://trpc.io/docs/v11/data-transformers
|
|
24
|
+
*/
|
|
25
|
+
transformer: superjson,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create a router
|
|
30
|
+
* @link https://trpc.io/docs/v11/router
|
|
31
|
+
*/
|
|
32
|
+
export const router = t.router;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create an unprotected procedure
|
|
36
|
+
* @link https://trpc.io/docs/v11/procedures
|
|
37
|
+
**/
|
|
38
|
+
export const publicProcedure = t.procedure;
|
|
39
|
+
|
|
40
|
+
// procedure that asserts that the user is logged in
|
|
41
|
+
export const authedProcedure = t.procedure.use(async (opts) => {
|
|
42
|
+
const { ctx } = opts;
|
|
43
|
+
// `ctx.user` is nullable
|
|
44
|
+
if (!ctx.userId) {
|
|
45
|
+
throw new TRPCError({ code: 'UNAUTHORIZED' });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return opts.next({
|
|
49
|
+
ctx: {
|
|
50
|
+
// ✅ user value is known to be non-null now
|
|
51
|
+
userId: ctx.userId,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Merge multiple routers together
|
|
58
|
+
* @link https://trpc.io/docs/v11/merging-routers
|
|
59
|
+
*/
|
|
60
|
+
export const mergeRouters = t.mergeRouters;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Create a server-side caller
|
|
64
|
+
* @link https://trpc.io/docs/v11/server/server-side-calls
|
|
65
|
+
*/
|
|
66
|
+
export const createCallerFactory = t.createCallerFactory;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import { NextRequest } from 'next/server';
|
|
3
|
+
|
|
4
|
+
interface AuthContext {
|
|
5
|
+
userId?: string | null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Inner function for `createContext` where we create the context.
|
|
10
|
+
* This is useful for testing when we don't want to mock Next.js' request/response
|
|
11
|
+
*/
|
|
12
|
+
export function createContextInner(): AuthContext {
|
|
13
|
+
return {
|
|
14
|
+
userId: null,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type Context = Awaited<ReturnType<typeof createContextInner>>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Creates context for an incoming request
|
|
22
|
+
* @link https://trpc.io/docs/v11/context
|
|
23
|
+
*/
|
|
24
|
+
export const createContext = async (request: NextRequest): Promise<Context> => {
|
|
25
|
+
// for API-response caching see https://trpc.io/docs/v11/caching
|
|
26
|
+
|
|
27
|
+
return createContextInner();
|
|
28
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the root router of lobe chat tRPC-backend
|
|
3
|
+
*/
|
|
4
|
+
import { publicProcedure, router } from '@/libs/trpc';
|
|
5
|
+
|
|
6
|
+
export const appRouter = router({
|
|
7
|
+
healthcheck: publicProcedure.query(() => "i'm live!"),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type AppRouter = typeof appRouter;
|