mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-05 17:17:14 +00:00
2317392ee5
* refactor(web): migrate from Next.js to Vite + React Router
* fix: update build pipelines for Vite migration (out → dist)
- Dockerfile: npm run build → npx vite build, web/out → web/dist
- pyproject.toml: package-data web/out/** → web/dist/**
- paths.py: support both web/dist (Vite) and web/out (legacy) with fallback
* fix: remove .next from git tracking, add to .gitignore
1334 cached files from web/.next/ were accidentally committed.
Added .next/ to both root and web/.gitignore.
* fix: update build process to use Vite and correct output directory
* fix: update pnpm-lock.yaml and eslint config for Vite migration
* style: fix prettier formatting issues
* fix: add eslint-plugin-react-hooks for Vite migration
* fix: remove undefined eslint rule reference, downgrade react-hooks plugin to v5
* fix(web): clean up remaining Next.js artifacts in Vite migration
- Add vite-env.d.ts for import.meta.env and asset type declarations
- Remove dead layout.tsx (providers already in main.tsx)
- Fix useSearchParams destructuring to [searchParams] tuple (11 locations)
- Replace process.env.NEXT_PUBLIC_* with import.meta.env.VITE_*
- Fix langbotIcon.src to langbotIcon (Vite returns URL string)
- Fix Link href to Link to for react-router-dom
- Fix navigate({ scroll: false }) to { preventScrollReset: true }
- Fix [router] dependency arrays to [navigate]
- Remove Next.js plugin from tsconfig, set rsc: false in components.json
- Replace next lint with eslint in lint-staged
* feat: add tools API endpoint and tools-selector form type
Backend:
- Add GET /api/v1/tools — list all available tools (plugin + MCP)
- Add GET /api/v1/tools/<tool_name> — get specific tool details
Frontend:
- Add TOOLS_SELECTOR form type for plugin config forms
- Multi-select dialog with tool name and description
- Add PluginTool entity type and API client methods
* Revert "feat: add tools API endpoint and tools-selector form type"
This reverts commit 3c637fc563.
107 lines
3.4 KiB
TypeScript
107 lines
3.4 KiB
TypeScript
import { useTranslation } from 'react-i18next';
|
|
import ReactMarkdown from 'react-markdown';
|
|
import remarkGfm from 'remark-gfm';
|
|
import rehypeRaw from 'rehype-raw';
|
|
import rehypeSanitize from 'rehype-sanitize';
|
|
import rehypeHighlight from 'rehype-highlight';
|
|
import i18n from 'i18next';
|
|
import { ExternalLink } from 'lucide-react';
|
|
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
DialogFooter,
|
|
} from '@/components/ui/dialog';
|
|
import { Button } from '@/components/ui/button';
|
|
import '@/styles/github-markdown.css';
|
|
import { GitHubRelease } from '@/app/infra/http/CloudServiceClient';
|
|
|
|
interface NewVersionDialogProps {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
release: GitHubRelease | null;
|
|
}
|
|
|
|
export default function NewVersionDialog({
|
|
open,
|
|
onOpenChange,
|
|
release,
|
|
}: NewVersionDialogProps) {
|
|
const { t } = useTranslation();
|
|
|
|
const getUpdateDocsUrl = () => {
|
|
const language = i18n.language;
|
|
if (language === 'zh-Hans' || language === 'zh-Hant') {
|
|
return 'https://link.langbot.app/zh/docs/update';
|
|
} else if (language === 'ja-JP') {
|
|
return 'https://link.langbot.app/ja/docs/update';
|
|
} else {
|
|
return 'https://link.langbot.app/en/docs/update';
|
|
}
|
|
};
|
|
|
|
const handleViewUpdateGuide = () => {
|
|
window.open(getUpdateDocsUrl(), '_blank');
|
|
};
|
|
|
|
if (!release) return null;
|
|
|
|
return (
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
<DialogContent className="sm:max-w-[600px] max-h-[80vh] flex flex-col">
|
|
<DialogHeader className="flex-shrink-0">
|
|
<DialogTitle className="flex items-center gap-2">
|
|
{t('version.newVersionAvailable')}
|
|
<span className="text-primary font-mono">{release.tag_name}</span>
|
|
</DialogTitle>
|
|
</DialogHeader>
|
|
<div className="flex-1 overflow-y-auto min-h-0 pr-2">
|
|
<div className="markdown-body max-w-none text-sm">
|
|
<ReactMarkdown
|
|
remarkPlugins={[remarkGfm]}
|
|
rehypePlugins={[rehypeRaw, rehypeSanitize, rehypeHighlight]}
|
|
components={{
|
|
ul: ({ children }) => <ul className="list-disc">{children}</ul>,
|
|
ol: ({ children }) => (
|
|
<ol className="list-decimal">{children}</ol>
|
|
),
|
|
li: ({ children }) => <li className="ml-4">{children}</li>,
|
|
a: ({ href, children }) => (
|
|
<a
|
|
href={href}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="text-primary hover:underline"
|
|
>
|
|
{children}
|
|
</a>
|
|
),
|
|
}}
|
|
>
|
|
{release.body || t('version.noReleaseNotes')}
|
|
</ReactMarkdown>
|
|
</div>
|
|
</div>
|
|
<DialogFooter className="flex-shrink-0 flex flex-col sm:flex-row gap-2 pt-2">
|
|
<Button
|
|
variant="outline"
|
|
onClick={() => onOpenChange(false)}
|
|
className="w-full sm:w-auto"
|
|
>
|
|
{t('common.close')}
|
|
</Button>
|
|
<Button
|
|
onClick={handleViewUpdateGuide}
|
|
className="w-full sm:w-auto flex items-center gap-2"
|
|
>
|
|
{t('version.viewUpdateGuide')}
|
|
<ExternalLink className="w-4 h-4" />
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|