fix: fix relay api auto fill route feat in serve_static mode

This commit is contained in:
Zhang Minghan 2024-03-13 20:26:59 +08:00
parent bd9b06e420
commit 8dde7c4f5f
5 changed files with 23 additions and 28 deletions

View File

@ -277,10 +277,10 @@ Apache License 2.0
## ❤ Sponsors
[@Sh1n3zZ](https://github.com/Sh1n3zZ) [@4EvEr](https://github.com/3081394176)
- [晞云 LightXi](https://open.lightxi.com) 提供字体 CDN 支持
- [BootCDN](https://bootcdn.cn) 和 [Static File](https://staticfile.org) 提供资源 CDN 支持
- [LightXi](https://open.lightxi.com) Provide Font CDN support
- [BootCDN](https://bootcdn.cn) & [Static File](https://staticfile.org) Provide Resources CDN support
## 写在最后
## At Last
Chat Nio leans towards a one-stop service, integrating user chat interface and API intermediary and management projects.
- Compared to projects like NextChat which are front-end and lightweight deployment-oriented, Chat Nio's advantages include more convenient cloud synchronization, account management, richer sharing functionalities, as well as a billing management system.
- Compared to projects like OneAPI which are backend and lightweight deployment-oriented, Chat Nio's advantages include a richer user interface, a more comprehensive channel management system, richer user management, and the introduction of a subscription management system aimed at the user interface.

View File

@ -101,7 +101,7 @@ func (c *ChatInstance) CreateStreamChatRequest(props *adaptercommon.ChatProps, c
return callback(&globals.Chunk{Content: ""})
}
if progress == 0 {
if !begin {
begin = true
if err := callback(&globals.Chunk{Content: "```progress\n"}); err != nil {
return err

View File

@ -1,11 +1,4 @@
.share-table {
max-height: 60vh;
max-width: 85vw;
overflow: auto;
scrollbar-width: thin;
padding: 0 0.5rem;
&::-webkit-scrollbar {
width: 0.5rem;
}
height: max-content;
}

View File

@ -38,6 +38,7 @@ import {
} from "@/components/ui/dropdown-menu.tsx";
import { getSharedLink, SharingPreviewForm } from "@/api/sharing.ts";
import { openWindow } from "@/utils/device.ts";
import { ScrollArea } from "@/components/ui/scroll-area.tsx";
type ShareTableProps = {
data: SharingPreviewForm[];
@ -55,7 +56,7 @@ function ShareTable({ data }: ShareTableProps) {
}, [data]);
return (
<Table className={`mt-5`}>
<Table>
<TableHeader>
<TableRow>
<TableHead>ID</TableHead>
@ -130,18 +131,20 @@ function ShareManagementDialog() {
<Dialog open={open} onOpenChange={(open) => dispatch(setDialog(open))}>
<DialogContent>
<DialogHeader>
<DialogTitle>{t("share.manage")}</DialogTitle>
{data.length > 0 ? (
<DialogDescription className={`share-table`}>
<ShareTable data={data} />
</DialogDescription>
) : (
<DialogDescription>
<p className={`text-center select-none mt-6 mb-2`}>
{t("conversation.empty")}
</p>
</DialogDescription>
)}
<DialogTitle className={`mb-4`}>{t("share.manage")}</DialogTitle>
{data.length > 0 ? (
<ScrollArea className={`max-h-[60vh]`}>
<DialogDescription className={`share-table`}>
<ShareTable data={data} />
</DialogDescription>
</ScrollArea>
) : (
<DialogDescription>
<p className={`text-center select-none mt-6 mb-2`}>
{t("conversation.empty")}
</p>
</DialogDescription>
)}
</DialogHeader>
<DialogFooter>
<Button variant={`outline`} onClick={() => dispatch(closeDialog())}>

View File

@ -155,9 +155,8 @@ func RegisterStaticRoute(engine *gin.Engine) {
for _, route := range redirectRoutes {
engine.Any(fmt.Sprintf("%s/*path", route), func(c *gin.Context) {
path := c.Param("path")
c.Request.URL.Path = path
c.Request.URL.Path = "/api" + c.Request.URL.Path
fmt.Println(c.Request.URL.Path)
engine.HandleContext(c)
})
}