Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to the latest version 2.11.3(Security update & minor changes) #7

Draft
wants to merge 718 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
718 commits
Select commit Hold shift + click to select a range
6f0846b
hotfix cache upload image
lloydzhou Jul 25, 2024
21ef9a4
feat: artifacts style
Dogtiti Jul 25, 2024
46a47db
Merge branch 'ChatGPTNextWeb:main' into main
ZTH7 Jul 25, 2024
5c04d3c
Change method
ZTH7 Jul 25, 2024
cf63619
Merge pull request #5103 from ConnectAI-E/hotfix-cache-upload-image
lloydzhou Jul 25, 2024
941a03e
Merge pull request #4983 from OpenAI-Next/dev-sd
lloydzhou Jul 25, 2024
825929f
merge main
lloydzhou Jul 25, 2024
6a083b2
fix typescript error
lloydzhou Jul 25, 2024
556d563
update
lloydzhou Jul 25, 2024
5ec0311
fix typescript error
lloydzhou Jul 25, 2024
51e8f04
Merge branch 'feature-artifacts' of https://github.com/ConnectAI-E/Ch…
Dogtiti Jul 25, 2024
c4334d4
Update model.ts
ZTH7 Jul 25, 2024
f5499ff
Merge pull request #5071 from ZTH7/main
lloydzhou Jul 25, 2024
c27ef6f
feat: artifacts style
Dogtiti Jul 25, 2024
a0f0b4f
Merge pull request #5 from ConnectAI-E/feature/artifacts-style
lloydzhou Jul 25, 2024
72d6f97
fix: ts error
Dogtiti Jul 26, 2024
f2d2622
fix: uploading loading
Dogtiti Jul 26, 2024
6737f01
chore: artifact => artifacts
Dogtiti Jul 26, 2024
715d1dc
fix: default enable artifacts
Dogtiti Jul 26, 2024
1772d5c
chore: update owner
Dogtiti Jul 26, 2024
3f9f556
fix: iframe bg
Dogtiti Jul 26, 2024
b27f394
Merge pull request #5092 from ConnectAI-E/feature-artifacts
ElricLiu Jul 26, 2024
8b51353
release v2.14.0
lloydzhou Jul 26, 2024
35c5518
Merge pull request #5110 from ConnectAI-E/fix/owner
lloydzhou Jul 26, 2024
3ef596b
Update README.md
ElricLiu Jul 29, 2024
d70d46b
Update README.md
ElricLiu Jul 29, 2024
071391d
Update README.md
ElricLiu Jul 29, 2024
90e1fad
Merge pull request #5124 from ElricLiu/main
lloydzhou Jul 29, 2024
d49ecec
✨ feat(markdown): wrap the plain text code block
frostime Jul 29, 2024
64c3dcd
hotfix for using google api in app
lloydzhou Jul 30, 2024
c9eb9f3
Merge pull request #5141 from ConnectAI-E/hotfix-google-api-in-app
Dogtiti Jul 30, 2024
8cb72d8
fix: locales => Locale
Dogtiti Jul 30, 2024
99f3160
fix: sidebar title style
Dogtiti Jul 31, 2024
04a4e1b
fix: replace '&' with concurrently for cross-platform compatibility
DDDDD12138 Jul 29, 2024
40cbabc
add moonshot api
lloydzhou Aug 1, 2024
b8bbc37
merge main
lloydzhou Aug 1, 2024
966db1e
add moonshot settings
lloydzhou Aug 1, 2024
f6a6c51
Merge pull request #5156 from ConnectAI-E/feature/moonshot
Dogtiti Aug 1, 2024
fd9e94e
merge main
lloydzhou Aug 1, 2024
a024980
revert package.json
lloydzhou Aug 1, 2024
f85ec95
hotfix for tencent sign
lloydzhou Aug 1, 2024
6a0bda0
merge main
lloydzhou Aug 1, 2024
e1d6131
update
lloydzhou Aug 1, 2024
c359b92
update
lloydzhou Aug 1, 2024
dfc36e5
update
lloydzhou Aug 1, 2024
a17df03
feat: add lodash-es
Dogtiti Aug 1, 2024
b3219f5
Merge pull request #5157 from ConnectAI-E/feature/tencent
Dogtiti Aug 1, 2024
753bf3b
hotfix for cf deploy error #5168
lloydzhou Aug 2, 2024
feaa6f9
Merge remote-tracking branch 'connectai/feature/tencent' into feature…
lloydzhou Aug 2, 2024
67a90ff
Merge pull request #5171 from ConnectAI-E/feature/tencent
Dogtiti Aug 2, 2024
ac599aa
add dalle3 model
lloydzhou Aug 2, 2024
957244b
Merge pull request #5154 from ConnectAI-E/fix-sidebar-style
lloydzhou Aug 2, 2024
9193a9a
Merge pull request #5147 from ConnectAI-E/fix-locales
lloydzhou Aug 2, 2024
1c24ca5
add dalle3 model
lloydzhou Aug 2, 2024
46cb480
fix typescript error
lloydzhou Aug 2, 2024
324d30b
Merge pull request #5136 from frostime/contrib-txtcode
lloydzhou Aug 2, 2024
a8c65e3
Merge pull request #5126 from DDDDD12138/fix-watch-mask
lloydzhou Aug 2, 2024
8c83fe2
using b64_json for dall-e-3
lloydzhou Aug 2, 2024
8498cad
fix: Fixed an issue where the sample of the reply content was display…
Aug 2, 2024
4a8e85c
fix: empty response
Dogtiti Aug 2, 2024
3c1e5e7
Merge branch 'ChatGPTNextWeb:main' into main
ahzmr Aug 2, 2024
deb140d
✨ feat: 为命令前缀( `:` )支持中文符号 `:`
frostime Aug 2, 2024
d9e407f
Merge pull request #5175 from frostime/upstream-main
Dogtiti Aug 3, 2024
716899c
fix: Fixed the issue that WebDAV synchronization could not check the …
Aug 3, 2024
b6a022b
✨ feat(config): Set markdown's font-family
frostime Aug 3, 2024
8ec6acc
🎨 i18n: add locale about "font family config"
frostime Aug 3, 2024
8a4b8a8
✨ feat: 调整模型列表,将自定义模型放在前面显示
frostime Aug 3, 2024
764c0cb
Merge pull request #5179 from frostime/contrib-font
Dogtiti Aug 3, 2024
724c814
Merge branch 'main' of https://github.com/ChatGPTNextWeb/ChatGPT-Next…
actions-user Aug 4, 2024
1610675
remove hash.js
lloydzhou Aug 5, 2024
4a95dcb
hotfix get wrong llm
lloydzhou Aug 5, 2024
141ce2c
reduce cloudflare functions build size
lloydzhou Aug 5, 2024
aa40015
Merge pull request #5190 from ConnectAI-E/feaure/hmac
Dogtiti Aug 5, 2024
d0e296a
fix: baidu error_code 336006
HyiKi Aug 5, 2024
b023a00
🔨 refactor(model): 更改原先的实现方法,在 collect table 函数后面增加额外的 sort 处理
frostime Aug 5, 2024
150fc84
✨ feat(model): 增加 sorted 字段,并使用该字段对模型列表进行排序
frostime Aug 5, 2024
3486954
🐛 fix(openai): 上次 commit 后 openai.ts 文件中出现类型不匹配的 bug
frostime Aug 5, 2024
a6b7432
Merge pull request #5180 from frostime/contrib-modellist
Dogtiti Aug 5, 2024
fec80c6
Merge pull request #5173 from ConnectAI-E/feature/dalle
Dogtiti Aug 5, 2024
9ab45c3
fix: baidu error_code 336006
HyiKi Aug 5, 2024
bfe4e88
Merge branch 'main' of https://github.com/ChatGPTNextWeb/ChatGPT-Next…
actions-user Aug 6, 2024
7deb36e
Merge branch 'main' of https://github.com/ChatGPTNextWeb/ChatGPT-Next…
actions-user Aug 6, 2024
d7e2ee6
fix: tencent InvalidParameter error
HyiKi Aug 6, 2024
0902efc
Merge branch 'fix-role-error'
HyiKi Aug 6, 2024
3da717d
fix: azure summary
Dogtiti Aug 6, 2024
94c4cf0
Merge pull request #5205 from ConnectAI-E/fix/azure-summary
lloydzhou Aug 6, 2024
6905421
Merge pull request #5194 from HyiKi/main
lloydzhou Aug 6, 2024
54fdf40
fix: baidu error_code 336006
HyiKi Aug 5, 2024
b667eff
fix: baidu error_code 336006
HyiKi Aug 5, 2024
f900283
fix: tencent InvalidParameter error
HyiKi Aug 6, 2024
5629f84
Merge pull request #5174 from ahzmr/main
lloydzhou Aug 6, 2024
b2c1644
feat: add support for iFLYTEK Spark API (接入讯飞星火模型)
webws Aug 3, 2024
9bbb4f3
Merge pull request #5181 from webws/feature/support-iflytek-spark
Dogtiti Aug 6, 2024
624e4db
update version
lloydzhou Aug 6, 2024
af21c57
ban gpt4
mayfwl Aug 7, 2024
58b144b
Merge pull request #5218 from ConnectAI-E/feature/bangpt
Dogtiti Aug 7, 2024
c9099ca
无障碍按钮和链接
mayfwl Aug 7, 2024
14ff46b
解决按钮无障碍
mayfwl Aug 7, 2024
034c82e
修改设置的无障碍
mayfwl Aug 7, 2024
42fdbd9
Fix spelling errors
122cygf Aug 7, 2024
aff1d7e
Merge pull request #5223 from 122cygf/main
Dogtiti Aug 7, 2024
0958b9e
tsxiugai
mayfwl Aug 8, 2024
036358d
Merge pull request #5219 from ConnectAI-E/feature/access
Dogtiti Aug 8, 2024
cc28aef
add gpt-4o-2024-08-06
mayfwl Aug 8, 2024
d948be2
Merge branch 'feature/bangpt' of ssh://github.com/ConnectAI-E/ChatGPT…
mayfwl Aug 8, 2024
cf1c8e8
Merge pull request #5233 from ConnectAI-E/feature/bangpt
Dogtiti Aug 8, 2024
4478763
tj
mayfwl Aug 8, 2024
8f759d1
代码折叠
mayfwl Aug 9, 2024
ca865a8
dall-e-3 adds 'quality' and 'style' options
MrrDrr Aug 10, 2024
6f75ef8
addcd
mayfwl Aug 10, 2024
356155f
feature add zhedie
mayfwl Aug 12, 2024
c3c3dd5
feature add zhedie
mayfwl Aug 12, 2024
1980f43
feat(auth): xg feature
mayfwl Aug 12, 2024
edb92f7
Merge pull request #5245 from MrrDrr/dalle3_add_options
Dogtiti Aug 13, 2024
fb5fc13
feat: add model name
DDMeaqua Aug 13, 2024
e2e8a45
Update README.md
ElricLiu Aug 14, 2024
cd92036
Add page to search chat history
Aug 14, 2024
3da5284
优化搜索算法,更新图标
Aug 15, 2024
122aa94
Merge pull request #5273 from ElricLiu/main
lloydzhou Aug 15, 2024
00990dc
use yarn instead of npm
Aug 15, 2024
98093a1
make search result item easier to click
Aug 15, 2024
65ed6b0
Merge branch 'main' into feat/search-history
Aug 15, 2024
8622057
Update yarn.lock to match origin version
Movelocity Aug 15, 2024
87325fa
Merge pull request #5270 from DDMeaqua/main
Dogtiti Aug 15, 2024
e3f499b
hide search button text
Aug 16, 2024
d88cc57
chore: update
DDMeaqua Aug 16, 2024
e033bef
Merge branch 'main' into feat-i18n
lloydzhou Aug 16, 2024
f64763b
Merge pull request #5093 from DDMeaqua/feat-i18n
lloydzhou Aug 16, 2024
e210db7
Merge pull request #5235 from ConnectAI-E/feature/access
lloydzhou Aug 16, 2024
8a38cdc
update version
lloydzhou Aug 16, 2024
495b321
Merge remote-tracking branch 'origin/main'
lloydzhou Aug 16, 2024
b84bb72
add null check for search content
Aug 17, 2024
82298a7
Merge branch 'main' into feat/search-history
Aug 17, 2024
fd1c656
add all translations for SearchChat
Aug 17, 2024
7ce2e8f
resolve a warning
Aug 17, 2024
1102ef6
fix: Determine if Tencent is authorized
zhangjian10 Aug 18, 2024
1e59948
Merge pull request #5288 from zhangjian10/main
Dogtiti Aug 19, 2024
fcd55df
wrap doSearch with useCallback
Aug 20, 2024
39d7d9f
migrate the search button to plugins discovery
Aug 20, 2024
b529118
Merge branch 'ChatGPTNextWeb:main' into feat/search-history
Movelocity Aug 20, 2024
64a0ffe
Merge branch 'main' into feat/search-history
Aug 20, 2024
6649fbd
remove an empty line
Aug 20, 2024
09a9066
Merge branch 'feat/search-history' of https://github.com/Movelocity/C…
Aug 20, 2024
e275abd
match the origin format
Aug 20, 2024
a6b14c7
Merge pull request #5274 from Movelocity/feat/search-history
lloydzhou Aug 20, 2024
cd49c12
fix: 修复查看全部按钮导致artifacts失效
lloydzhou Aug 20, 2024
8b67536
fix: 修复多余的查看全部
lloydzhou Aug 20, 2024
b0e9a54
frat: add reload button
lloydzhou Aug 21, 2024
4b9697e
fix: typescript error
lloydzhou Aug 21, 2024
3d5b211
update
lloydzhou Aug 21, 2024
ffe3269
Merge pull request #5300 from ConnectAI-E/hotfix/hide-button
lloydzhou Aug 21, 2024
8496980
Modify View All Languages
mayfwl Aug 21, 2024
95332e5
Merge branch 'main' into Modifylang
mayfwl Aug 21, 2024
1748dd6
Merge pull request #5303 from ConnectAI-E/Modifylang
Dogtiti Aug 21, 2024
4ec6b06
fix: artifact render error (#5306)
mayfwl Aug 21, 2024
0c3fb5b
Update README.md
ElricLiu Aug 23, 2024
718782f
Merge pull request #5309 from ElricLiu/main
lloydzhou Aug 24, 2024
c99cd31
add openapi-client-axios
lloydzhou Aug 24, 2024
4060e36
feat: add indexDB
Dogtiti Aug 26, 2024
492b55c
feat: add indexDB
Dogtiti Aug 26, 2024
0b75894
feat: clear indexDB
Dogtiti Aug 26, 2024
c2fc0b4
feat: try catch indexedDB error
Dogtiti Aug 27, 2024
7b6fe66
feat: try catch indexedDB error
Dogtiti Aug 27, 2024
b6bb167
Merge pull request #5324 from ConnectAI-E/feature/indexdb
lloydzhou Aug 27, 2024
f5209fc
stash code
lloydzhou Aug 28, 2024
29b5cd9
ts error
lloydzhou Aug 28, 2024
f3f6dc5
stash code
lloydzhou Aug 28, 2024
d212df8
stash code
lloydzhou Aug 28, 2024
f7a5f83
stash code
lloydzhou Aug 28, 2024
d58b99d
stash code
lloydzhou Aug 28, 2024
341a52a
stash code
lloydzhou Aug 28, 2024
7fc0d11
create common function stream for fetchEventSource
lloydzhou Aug 29, 2024
d2cb984
add processToolMessage callback
lloydzhou Aug 29, 2024
571ce11
stash code
lloydzhou Aug 29, 2024
19c7a84
fix: right click
Dogtiti Aug 29, 2024
97a4a91
Merge pull request #5335 from ConnectAI-E/fix/right-click
Dogtiti Aug 29, 2024
cac99e3
add Plugin page
lloydzhou Aug 30, 2024
271f58d
stash code
lloydzhou Aug 30, 2024
9326ff9
ts error
lloydzhou Aug 30, 2024
2214689
add gapier proxy
lloydzhou Aug 30, 2024
b2965e1
update
lloydzhou Aug 30, 2024
f652f73
plugin add auth config
lloydzhou Sep 2, 2024
877668b
hotfix
lloydzhou Sep 2, 2024
801b625
claude support function call
lloydzhou Sep 2, 2024
078305f
kimi support function call
lloydzhou Sep 2, 2024
6435e7a
update readme
lloydzhou Sep 2, 2024
3ec67f9
add load from url
lloydzhou Sep 2, 2024
2b317f6
add config auth location
lloydzhou Sep 3, 2024
236736d
remove no need code
lloydzhou Sep 3, 2024
4fdd997
hotfix
lloydzhou Sep 3, 2024
886ffc0
fix: hydrated for indexedDB
Dogtiti Sep 3, 2024
d30351e
update readme
lloydzhou Sep 3, 2024
c7bc93b
Merge remote-tracking branch 'connectai/main' into feature/plugin
lloydzhou Sep 3, 2024
0a5522d
update
lloydzhou Sep 3, 2024
7180ed9
hotfix
lloydzhou Sep 3, 2024
6ab6b3d
remove no need code
lloydzhou Sep 3, 2024
ed9aae5
fix: hydrated
Dogtiti Sep 3, 2024
04e1ab6
update readme
lloydzhou Sep 4, 2024
53dcae9
update
lloydzhou Sep 4, 2024
8570457
Merge pull request #5356 from ConnectAI-E/feature/indexdb
lloydzhou Sep 4, 2024
f9a047a
using tauri http api run plugin to fixed cors in App
lloydzhou Sep 4, 2024
09aec7b
using tauri http api run plugin to fixed cors in App
lloydzhou Sep 4, 2024
9820193
Merge pull request #6 from ConnectAI-E/feature/plugin-app-cors
lloydzhou Sep 4, 2024
b590d08
disable nextjs proxy, then can using dalle as plugin
lloydzhou Sep 5, 2024
caf50b6
move artifacts into mask settings
lloydzhou Sep 5, 2024
80b8f95
move artifacts into mask settings
lloydzhou Sep 5, 2024
f32dd69
Merge pull request #7 from ConnectAI-E/feature/plugin-artifact
lloydzhou Sep 5, 2024
7c0acc7
hotfix tools empty array
lloydzhou Sep 5, 2024
7455978
default enable artifact
lloydzhou Sep 6, 2024
9275f2d
add awesome plugin repo url
lloydzhou Sep 6, 2024
2bd799f
Merge pull request #5331 from ConnectAI-E/feature/plugin
Dogtiti Sep 6, 2024
27828d9
fix: update package version
Kosette Sep 6, 2024
c1b7420
add chatgpt-4o-latest
MrrDrr Sep 6, 2024
fe5a4f4
Merge pull request #5375 from Kosette/fix-version
lloydzhou Sep 7, 2024
cf0c057
hotfix Mermaid can not render. close #5374
lloydzhou Sep 7, 2024
116a73d
Merge pull request #5377 from ConnectAI-E/hotfix/mermaid
lloydzhou Sep 7, 2024
5a81393
Add crossOrigin="use-credentials" for site.webmanifest
reggiezhang Sep 7, 2024
2ff292c
Merge pull request #5381 from reggiezhang/patch-1
lloydzhou Sep 7, 2024
db58ca6
fix(#5378): default plugin ids to empty array
SukkaW Sep 7, 2024
daeffb2
Merge pull request #5383 from SukkaW/fix-5378
lloydzhou Sep 7, 2024
23ac2ef
hotfix and update version
lloydzhou Sep 7, 2024
d51d7b6
Merge pull request #5376 from MrrDrr/add_chatgpt_4o_latest
mayfwl Sep 8, 2024
992c3a5
fix: safaLocalStorage
Dogtiti Sep 8, 2024
35f77f4
Merge pull request #5386 from ConnectAI-E/feature/safeLocalStorage
Dogtiti Sep 9, 2024
f219515
feat: add shortcut key
DDMeaqua Sep 9, 2024
7804182
fix: type error
DDMeaqua Sep 9, 2024
61245e3
fix: dark theme css
DDMeaqua Sep 9, 2024
e578c5f
chore: 样式更新
DDMeaqua Sep 10, 2024
18e2403
chore: 更换icon
DDMeaqua Sep 10, 2024
45306bb
fix: ts error
DDMeaqua Sep 10, 2024
1234dea
Merge pull request #5396 from DDMeaqua/feat-shortcutkey
Dogtiti Sep 12, 2024
88b1c1c
fix typo
xmcp Sep 12, 2024
4b8288a
fix: #4240 remove tip when 0 context
Leizhenpeng Sep 12, 2024
5964181
Merge pull request #5405 from xmcp/patch-1
Dogtiti Sep 12, 2024
07c6fe5
Merge pull request #5406 from ChatGPTNextWeb/river
Dogtiti Sep 12, 2024
6bb01bc
fix: remove the visual model judgment method that checks if the model…
skymkmk Sep 13, 2024
71df415
feat: add o1 model
skymkmk Sep 13, 2024
169323e
Merge pull request #5415 from skymkmk/pr-fix-incorrect-vision-model-j…
Dogtiti Sep 13, 2024
d0dce65
fix: shouldstream is not depend on iso1
skymkmk Sep 13, 2024
03fa580
fix: give o1 some time to think twice
skymkmk Sep 13, 2024
affc194
Merge pull request #5416 from skymkmk/pr-add-o1
Dogtiti Sep 13, 2024
3dabe47
fixed: html codeblock include 2 newline
lloydzhou Sep 13, 2024
db39fbc
chore: 手机端隐藏快捷键展示
DDMeaqua Sep 13, 2024
57fcda8
Merge pull request #5419 from DDMeaqua/feat-shortcutkey
lloydzhou Sep 13, 2024
6a464b3
Merge pull request #5418 from ConnectAI-E/hotfix/artifact
Dogtiti Sep 13, 2024
df62736
update version
lloydzhou Sep 13, 2024
79cfbac
Add a space between model and provider in ModelSelector to improve re…
Dakai Sep 13, 2024
84a7afc
feat: Improve setting.model selector
tuanzisama Sep 14, 2024
4eb4c31
Merge pull request #5428 from Dakai/main
Dogtiti Sep 14, 2024
f379865
Merge pull request #5431 from tuanzisama/tuanzisama-patch-1
Dogtiti Sep 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ One-Click to get a well-designed cross-platform ChatGPT web UI, with GPT3, GPT4
[MacOS-image]: https://img.shields.io/badge/-MacOS-black?logo=apple
[Linux-image]: https://img.shields.io/badge/-Linux-333?logo=ubuntu

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgit.luolix.top%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&env=GOOGLE_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgit.luolix.top%2FChatGPTNextWeb%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=nextchat&repository-name=NextChat)

[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/ZBUEFA)

Expand Down
43 changes: 0 additions & 43 deletions app/api/cors/[...path]/route.ts

This file was deleted.

73 changes: 73 additions & 0 deletions app/api/upstash/[action]/[...key]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { NextRequest, NextResponse } from "next/server";

async function handle(
req: NextRequest,
{ params }: { params: { action: string; key: string[] } },
) {
const requestUrl = new URL(req.url);
const endpoint = requestUrl.searchParams.get("endpoint");

if (req.method === "OPTIONS") {
return NextResponse.json({ body: "OK" }, { status: 200 });
}
const [...key] = params.key;
// only allow to request to *.upstash.io
if (!endpoint || !new URL(endpoint).hostname.endsWith(".upstash.io")) {
return NextResponse.json(
{
error: true,
msg: "you are not allowed to request " + params.key.join("/"),
},
{
status: 403,
},
);
}

// only allow upstash get and set method
if (params.action !== "get" && params.action !== "set") {
console.log("[Upstash Route] forbidden action ", params.action);
return NextResponse.json(
{
error: true,
msg: "you are not allowed to request " + params.action,
},
{
status: 403,
},
);
}

const targetUrl = `${endpoint}/${params.action}/${params.key.join("/")}`;

const method = req.method;
const shouldNotHaveBody = ["get", "head"].includes(
method?.toLowerCase() ?? "",
);

const fetchOptions: RequestInit = {
headers: {
authorization: req.headers.get("authorization") ?? "",
},
body: shouldNotHaveBody ? null : req.body,
method,
// @ts-ignore
duplex: "half",
};

console.log("[Upstash Proxy]", targetUrl, fetchOptions);
const fetchResult = await fetch(targetUrl, fetchOptions);

console.log("[Any Proxy]", targetUrl, {
status: fetchResult.status,
statusText: fetchResult.statusText,
});

return fetchResult;
}

export const POST = handle;
export const GET = handle;
export const OPTIONS = handle;

export const runtime = "edge";
112 changes: 112 additions & 0 deletions app/api/webdav/[...path]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import { NextRequest, NextResponse } from "next/server";
import { STORAGE_KEY } from "../../../constant";
async function handle(
req: NextRequest,
{ params }: { params: { path: string[] } },
) {
if (req.method === "OPTIONS") {
return NextResponse.json({ body: "OK" }, { status: 200 });
}
const folder = STORAGE_KEY;
const fileName = `${folder}/backup.json`;

const requestUrl = new URL(req.url);
let endpoint = requestUrl.searchParams.get("endpoint");
if (!endpoint?.endsWith("/")) {
endpoint += "/";
}
const endpointPath = params.path.join("/");

// only allow MKCOL, GET, PUT
if (req.method !== "MKCOL" && req.method !== "GET" && req.method !== "PUT") {
return NextResponse.json(
{
error: true,
msg: "you are not allowed to request " + params.path.join("/"),
},
{
status: 403,
},
);
}

// for MKCOL request, only allow request ${folder}
if (
req.method == "MKCOL" &&
!new URL(endpointPath).pathname.endsWith(folder)
) {
return NextResponse.json(
{
error: true,
msg: "you are not allowed to request " + params.path.join("/"),
},
{
status: 403,
},
);
}

// for GET request, only allow request ending with fileName
if (
req.method == "GET" &&
!new URL(endpointPath).pathname.endsWith(fileName)
) {
return NextResponse.json(
{
error: true,
msg: "you are not allowed to request " + params.path.join("/"),
},
{
status: 403,
},
);
}

// for PUT request, only allow request ending with fileName
if (
req.method == "PUT" &&
!new URL(endpointPath).pathname.endsWith(fileName)
) {
return NextResponse.json(
{
error: true,
msg: "you are not allowed to request " + params.path.join("/"),
},
{
status: 403,
},
);
}

const targetUrl = `${endpoint + endpointPath}`;

const method = req.method;
const shouldNotHaveBody = ["get", "head"].includes(
method?.toLowerCase() ?? "",
);

const fetchOptions: RequestInit = {
headers: {
authorization: req.headers.get("authorization") ?? "",
},
body: shouldNotHaveBody ? null : req.body,
method,
// @ts-ignore
duplex: "half",
};

const fetchResult = await fetch(targetUrl, fetchOptions);

console.log("[Any Proxy]", targetUrl, {
status: fetchResult.status,
statusText: fetchResult.statusText,
});

return fetchResult;
}

export const POST = handle;
export const GET = handle;
export const OPTIONS = handle;

export const runtime = "edge";
1 change: 0 additions & 1 deletion app/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export function getHeaders() {
const accessStore = useAccessStore.getState();
const headers: Record<string, string> = {
"Content-Type": "application/json",
"x-requested-with": "XMLHttpRequest",
Accept: "application/json",
};
const modelConfig = useChatStore.getState().currentSession().mask.modelConfig;
Expand Down
10 changes: 10 additions & 0 deletions app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ export class ChatGPTApi implements LLMApi {
// Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
};

// add max_tokens to vision model
if (visionModel) {
Object.defineProperty(requestPayload, "max_tokens", {
enumerable: true,
configurable: true,
writable: true,
value: modelConfig.max_tokens,
});
}

console.log("[Request] openai payload: ", requestPayload);

const shouldStream = !!options.config.stream;
Expand Down
66 changes: 60 additions & 6 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, {
useMemo,
useCallback,
Fragment,
RefObject,
} from "react";

import SendWhiteIcon from "../icons/send-white.svg";
Expand Down Expand Up @@ -382,11 +383,13 @@ function ChatAction(props: {
);
}

function useScrollToBottom() {
function useScrollToBottom(
scrollRef: RefObject<HTMLDivElement>,
detach: boolean = false,
) {
// for auto-scroll
const scrollRef = useRef<HTMLDivElement>(null);
const [autoScroll, setAutoScroll] = useState(true);

const [autoScroll, setAutoScroll] = useState(true);
function scrollDomToBottom() {
const dom = scrollRef.current;
if (dom) {
Expand All @@ -399,7 +402,7 @@ function useScrollToBottom() {

// auto scroll
useEffect(() => {
if (autoScroll) {
if (autoScroll && !detach) {
scrollDomToBottom();
}
});
Expand Down Expand Up @@ -658,7 +661,17 @@ function _Chat() {
const [userInput, setUserInput] = useState("");
const [isLoading, setIsLoading] = useState(false);
const { submitKey, shouldSubmit } = useSubmitHandler();
const { scrollRef, setAutoScroll, scrollDomToBottom } = useScrollToBottom();
const scrollRef = useRef<HTMLDivElement>(null);
const isScrolledToBottom = scrollRef?.current
? Math.abs(
scrollRef.current.scrollHeight -
(scrollRef.current.scrollTop + scrollRef.current.clientHeight),
) <= 1
: false;
const { setAutoScroll, scrollDomToBottom } = useScrollToBottom(
scrollRef,
isScrolledToBottom,
);
const [hitBottom, setHitBottom] = useState(true);
const isMobileScreen = useMobileScreen();
const navigate = useNavigate();
Expand Down Expand Up @@ -1003,7 +1016,6 @@ function _Chat() {
setHitBottom(isHitBottom);
setAutoScroll(isHitBottom);
};

function scrollToBottom() {
setMsgRenderIndex(renderMessages.length - CHAT_PAGE_SIZE);
scrollDomToBottom();
Expand Down Expand Up @@ -1088,6 +1100,47 @@ function _Chat() {
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const handlePaste = useCallback(
async (event: React.ClipboardEvent<HTMLTextAreaElement>) => {
const currentModel = chatStore.currentSession().mask.modelConfig.model;
if(!isVisionModel(currentModel)){return;}
const items = (event.clipboardData || window.clipboardData).items;
for (const item of items) {
if (item.kind === "file" && item.type.startsWith("image/")) {
event.preventDefault();
const file = item.getAsFile();
if (file) {
const images: string[] = [];
images.push(...attachImages);
images.push(
...(await new Promise<string[]>((res, rej) => {
setUploading(true);
const imagesData: string[] = [];
compressImage(file, 256 * 1024)
.then((dataUrl) => {
imagesData.push(dataUrl);
setUploading(false);
res(imagesData);
})
.catch((e) => {
setUploading(false);
rej(e);
});
})),
);
const imagesLength = images.length;

if (imagesLength > 3) {
images.splice(3, imagesLength - 3);
}
setAttachImages(images);
}
}
}
},
[attachImages, chatStore],
);

async function uploadImage() {
const images: string[] = [];
Expand Down Expand Up @@ -1437,6 +1490,7 @@ function _Chat() {
onKeyDown={onInputKeyDown}
onFocus={scrollToBottom}
onClick={scrollToBottom}
onPaste={handlePaste}
rows={inputRows}
autoFocus={autoFocus}
style={{
Expand Down
1 change: 1 addition & 0 deletions app/components/emoji.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function AvatarPicker(props: {
}) {
return (
<EmojiPicker
width={"100%"}
lazyLoadEmojis
theme={EmojiTheme.AUTO}
getEmojiUrl={getEmojiUrl}
Expand Down
2 changes: 2 additions & 0 deletions app/components/settings.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

.avatar {
cursor: pointer;
position: relative;
z-index: 1;
}

.edit-prompt-modal {
Expand Down
Loading