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 ## ❤ Sponsors
[@Sh1n3zZ](https://github.com/Sh1n3zZ) [@4EvEr](https://github.com/3081394176) [@Sh1n3zZ](https://github.com/Sh1n3zZ) [@4EvEr](https://github.com/3081394176)
- [晞云 LightXi](https://open.lightxi.com) 提供字体 CDN 支持 - [LightXi](https://open.lightxi.com) Provide Font CDN support
- [BootCDN](https://bootcdn.cn) 和 [Static File](https://staticfile.org) 提供资源 CDN 支持 - [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. 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 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. - 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: ""}) return callback(&globals.Chunk{Content: ""})
} }
if progress == 0 { if !begin {
begin = true begin = true
if err := callback(&globals.Chunk{Content: "```progress\n"}); err != nil { if err := callback(&globals.Chunk{Content: "```progress\n"}); err != nil {
return err return err

View File

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

View File

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

View File

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