Repository: askaitools/askaitools-community-edition
Branch: master
Commit: 37b9e744f05f
Files: 27
Total size: 49.9 KB
Directory structure:
gitextract_fkoby6mu/
├── .gitignore
├── LICENSE
├── NOTICE.txt
├── README.md
├── README_CN.md
├── app/
│ ├── .gitignore
│ ├── components/
│ │ ├── Footer.tsx
│ │ ├── ItemsTileGrid.tsx
│ │ ├── Layout.tsx
│ │ ├── LogoImage.tsx
│ │ ├── Nav.tsx
│ │ └── SectionContainer.tsx
│ ├── lib/
│ │ ├── supabase.ts
│ │ └── theme.tsx
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── package.json
│ ├── pages/
│ │ ├── _app.tsx
│ │ ├── api/
│ │ │ └── embedding_search.ts
│ │ └── index.tsx
│ ├── postcss.config.js
│ ├── prettier.config.js
│ ├── styles/
│ │ └── globals.css
│ ├── tailwind.config.js
│ ├── tsconfig.json
│ └── types/
│ └── items.ts
└── supabase/
└── migrations/
└── 20240506_init.sql
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
/node_modules/
/.idea/
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: NOTICE.txt
================================================
Copyright 2024 AskAITools
In addition to the terms of the Apache License 2.0, any derivative works or projects based on this open-source project must prominently acknowledge that they are derived from or based on this project. This acknowledgement must be made in at least one of the following places: in the derivative project's documentation, or user interface.
================================================
FILE: README.md
================================================
# AskAITools Community Edition
## Overview
AskAITools (https://askaitools.ai) is a cutting-edge search engine project tailored specifically for the AI product domain. Our mission is to revolutionize the way users discover AI products by providing the most accurate, comprehensive, lightning-fast, and intelligent search experience. With AskAITools, finding the perfect AI solution has never been easier.
**AskAITools Desktop Web Screenshot:**
[](https://askaitools.ai)
**AskAITools Mobile Web Screenshot:**
[](https://askaitools.ai)
This project comes in two flavors: a feature-rich commercial edition and a community edition. The community edition offers a solid foundation with a basic front-end interface and search functionality, and its code is completely open-source in this repository. Developers can effortlessly integrate their own data on top of this framework, enabling them to swiftly build specialized vertical search engines or internal document search systems for their organizations.
Under the hood, AskAITools employs a hybrid search engine architecture, seamlessly combining keyword search (full-text search) and semantic search (vector search/embedding search) capabilities. By leveraging statistical data and weighted fusion techniques, it achieves a balance between relevance and popularity.
## Project Architecture and Tech Stack
- Front-end: Next.js
- Deployment: Vercel
- Styling: Tailwind CSS
- Database: Supabase
- Keyword Search: PostgreSQL / Supabase Full-Text Search Engine
- Semantic Search: Pgvector / Supabase Vector Database
- Semantic Vector Generation: OpenAI text-embedding-3 model
## Getting Started
1. Gather and structure your niche data. Refer to [our data table schema](./supabase/migrations/20240506_init.sql) for guidance on the required fields.
2. Modify the `item` table schema as needed. Create the table and import the data into Supabase.
3. Duplicate the environment variable template `.env.local.example` and rename it to `.env.local`. Fill in your Supabase and OpenAI configuration details. If needed, provide proxy information.
4. Tailor the search parameters and strategies in `./app/pages/index.tsx`, `./app/pages/api/embedding_search.ts`, and `./supabase/migrations/20240506_init.sql` to suit your requirements.
5. Refer to `20240506_init.sql` and create two search functions in Supabase.
6. In the `app` directory, run `yarn install` to install dependencies, followed by `yarn dev` to initiate the local development environment and conduct code debugging.
7. Follow the Vercel official documentation to deploy your project on Vercel.
8. Once deployed, celebrate your accomplishment 🎉
## Usage Restrictions
1. All projects that are derivatives of this project must prominently acknowledge AskAITools by displaying its name and open-source address on the user interface homepage or documentation homepage. The easiest way to comply with this requirement is to keep the "Powered by AskAITools" component intact in the footer.
2. When deploying projects derived from this open-source project, please avoid using the AskAITools brand name as your product/project name. This restriction does not apply to the ["AskAITools Commercial Edition"](https://askaitools.ai) (https://askaitools.ai).
3. If you want to develop AI product search platforms, AI product directory sites, or other projects that closely resemble the AskAITools Commercial Edition using this open-source project as a foundation, please redesign and redevelop the front-end pages. Failure to do so may result in Google identifying the later-launched website as plagiarism due to similar formatting and content, potentially hindering its ability to attract search traffic.
================================================
FILE: README_CN.md
================================================
# AskAITools 开源社区版
## 概述
AskAITools (https://askaitools.ai) 是专为 AI 产品领域设计的顶级搜索引擎项目,致力于打造 AI 产品领域中最卓越的搜索引擎。我们的目标是为用户提供最精准、最全面、最快速、最智能的搜索体验,使其成为用户寻找 AI 产品时的首选。
**AskAITools 桌面版网页截图:**
[](https://askaitools.ai)
**AskAITools 移动版网页截图:**
[](https://askaitools.ai)
此项目包括商业版与社区版两个版本,社区版提供基础前端界面和搜索功能,代码完全开源。开发者可以在此基础上,轻松添加自己的数据,迅速构建专业的垂域搜索引擎或用于企业内部文档搜索。
本搜索引擎是一种混合型搜索引擎,具备关键词搜索(全文搜索)和语义搜索(向量搜索/嵌入搜索)功能,结合统计数据进行加权融合,实现了在相关性和热度两方面的平衡。
## 项目架构与技术栈
- 前端:Next.js
- 部署:Vercel
- 样式:Tailwind CSS
- 数据库:Supabase
- 关键词搜索:Postgresql / Supabase 全文搜索引擎
- 语义搜索:Pgvector / Supabase 向量数据库
- 语义向量生成:OpenAI text-embedding-3 模型
## 使用步骤
1. 收集并整理你的垂域数据,详细字段可参照[我的数据表结构](./supabase/migrations/20240506_init.sql)。
2. 根据你的数据需要调整 `item` 表结构,在 Supabase 中创建并导入数据表。
3. 将环境变量模板 `.env.local.example` 复制为 `.env.local` 并填入你的 Supabase 和 OpenAI 配置信息,必要时填写代理信息。
4. 根据需求,调整 `./app/pages/index.tsx`、`./app/pages/api/embedding_search.ts` 与 `./supabase/migrations/20240506_init.sql` 中的搜索参数和搜索策略。
5. 参考 `20240506_init.sql`,在 Supabase 中创建两个搜索函数。
6. 在 `app` 目录下执行 `yarn install` 安装依赖,之后运行 `yarn dev` 启动本地开发环境并进行代码调试。
7. 遵循 Vercel 官方文档将项目部署至 Vercel。
8. 部署成功后,庆祝成果🎉
## 使用限制
1. 基于本项目进行二次开发的项目,必须在用户界面首页或文档首页的显著位置,注明本开源项目的名称和开源地址。最简单的做法是,保留页脚中的 "Powered by AskAITools" 组件。
2. 基于本项目进行二次开发并部署上线的项目,除 [AskAITools 商业版](https://askaitools.ai)(https://askaitools.ai )外,请勿使用 AskAITools 品牌名作为产品 / 项目名称。
3. 如果基于本项目二次开发 AI 产品搜索站或 AI 产品导航站等和 AskAITools 商业版接近的项目,请重新设计、开发前端页面。否则相同格式、相似内容,后上线的网站很可能被谷歌判定为抄袭,从而无法获得搜索流量。
================================================
FILE: app/.gitignore
================================================
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# lockfile
package-lock.json
yarn.lock
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel
# typescript
*.tsbuildinfo
================================================
FILE: app/components/Footer.tsx
================================================
import GitHubButton from 'react-github-btn'
const Footer = () => {
return (
<footer className="flex flex-col items-center justify-center w-full border-t bg-scale-300 p-4 text-sm">
<div className="text-gray-700 mb-2">Powered by
<a href="https://github.com/askaitools/askaitools-community-edition" target="_blank" rel="noopener" className="text-blue-500 underline ml-1">AskAITools</a>
</div>
<GitHubButton href="https://github.com/askaitools/askaitools-community-edition" data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="small" data-show-count="true" aria-label="Star askaitools/askaitools-community-edition on GitHub">Star</GitHubButton>
</footer>
)
}
export default Footer
================================================
FILE: app/components/ItemsTileGrid.tsx
================================================
import Link from 'next/link'
import {Items} from '~/types/items'
import LogoImage from './LogoImage';
export default function PartnerTileGrid({
searchResults
}: {
searchResults: Items[]
}) {
function formatVisitsCount(countNumber : bigint, language = 'en_US') {
const count = Number(countNumber);
if (count < 1_000) {
return count.toString();
} else if (count < 1_000_000) {
return (count / 1_000).toFixed(1) + 'K';
} else if (count < 1_000_000_000) {
return (count / 1_000_000).toFixed(1) + 'M';
} else {
return (count / 1_000_000_000).toFixed(1) + 'B';
}
}
return (
<>
<div className="not-prose space-y-0">
<div className="grid gap-2 grid-cols-1 md:grid-cols-1 lg:max-w-none">
{searchResults.map((p) => (
<a key={p.id} href={p.url} target="_blank" rel="noopener dofollow">
<div
className="bg-[#fcfcfc]
hover:bg-gray-100 hover:dark:bg-scale-400
group flex flex-col w-full h-full px-5 py-1 transition-all
border rounded-l
shadow
hover:shadow-lg"
>
<div className="flex w-full items-center space-x-4">
<div className="flex-none transition-all group-hover:scale-110">
<LogoImage logo={p.logo} title={p.title} />
</div>
<div className="flex-1 min-w-0 py-1">
<h3 className="text-sm font-bold transition-colors group-hover:text-blue-500 whitespace-nowrap overflow-hidden text-ellipsis mt-0"
title={p.url}
>
{p.title}
</h3>
<p
className="text-xs whitespace-nowrap overflow-hidden text-ellipsis mb-1"
title={p.brief}
>
{p.brief}
</p>
<div className="flex flex-wrap items-center mt-0">
{p.visitstotalcount&& (
<span
className="text-xs text-gray-600 mr-2 mb-1"
>
👥 {formatVisitsCount(p.visitstotalcount)}
</span>
)}
{p.visitsavgdurationformatted && (
<span
className="text-xs text-gray-600 mr-2 mb-1"
>
⏱️ {p.visitsavgdurationformatted.startsWith("00:")
? p.visitsavgdurationformatted.substring(3)
: p.visitsavgdurationformatted}
</span>
)}
{p.bouncerate && (
<span
className="text-xs text-gray-600 mb-1"
>
🤝 {Math.round((1 - p.bouncerate) * 100)}%
</span>
)}
</div>
</div>
</div>
</div>
</a>
))}
</div>
</div>
</>
)
}
================================================
FILE: app/components/Layout.tsx
================================================
import {PropsWithChildren, useEffect, useState} from 'react'
import Nav from './Nav'
import Footer from './Footer'
type LayoutProps = {}
const Layout = ({
children,
}: PropsWithChildren<LayoutProps>) => {
const [navHeight, setNavHeight] = useState(0);
useEffect(() => {
document.documentElement.className = 'light'
const nav = document.querySelector('nav');
if (nav) {
setNavHeight(nav.offsetHeight);
}
}, [])
return (
<>
<div className="flex flex-col min-h-screen">
<div className="fixed top-0 w-full z-10"><Nav/></div>
<div className="flex-1" style={{paddingTop: `${navHeight}px`}}>
<main>{children}</main>
</div>
<Footer/>
</div>
</>
)
}
export default Layout
================================================
FILE: app/components/LogoImage.tsx
================================================
import React, { useState } from 'react';
import Image from 'next/image';
const LogoImage: React.FC<{ logo: string | undefined; title: string }> = ({ logo, title }) => {
const [imageError, setImageError] = useState(false);
const handleImageError = () => {
setImageError(true);
};
if (!logo) {
return (
<Image
width={40}
height={40}
className="bg-gray-300 rounded-full"
src="/images/logo-wordmark--light.svg"
alt={title}
/>
);
}
const fileExtension = logo?.split('.').pop()?.toLowerCase() ?? '';
const logoUrl = `https://example.com/${logo}`; // Replace with your actual logo URL
if (fileExtension === 'svg') {
return (
<div className="bg-gray-300 rounded-full w-10 h-10 flex items-center justify-center">
{imageError ? (
<img src="/images/logo-wordmark--light.svg" alt={title} />
) : (
<img src={logoUrl} alt={title} onError={handleImageError} />
)}
</div>
);
}
return (
<Image
width={40}
height={40}
className="bg-gray-300 rounded-full"
src={imageError ? '/images/logo-wordmark--light.svg' : logoUrl}
alt={title}
onError={handleImageError}
/>
);
};
export default LogoImage;
================================================
FILE: app/components/Nav.tsx
================================================
import Image from 'next/image';
import Link from 'next/link';
import {useState} from 'react';
import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline';
interface LogoProps {
isDarkMode: boolean | undefined;
}
const Logo = ({ isDarkMode }: LogoProps) => {
return (
<Link href="https://askaitools.ai" className="flex items-center justify-center md:justify-start">
<Image
src={isDarkMode ? '/images/logo-wordmark--dark.svg' : '/images/logo-wordmark--light.svg'}
alt="Logo"
height={30}
width={30}
/>
<span className={`ml-3 font-bold text-lg ${isDarkMode ? 'text-white' : 'text-black'}`}>
Your Product Name
</span>
</Link>
);
};
const SocialMediaLinks = ({ isDarkMode }: LogoProps) => {
return (
<>
{/* Replace with your actual social media links */}
<a className="flex mr-3" href="https://askaitools.ai" target="_blank" rel="noopener">
<Image src='/images/Gmail_logo.svg' alt="Email" height={24} width={30}/>
</a>
<a className="flex mr-3" href="https://askaitools.ai" target="_blank" rel="noopener">
<Image
src={isDarkMode ? '/images/TwitterX_logo--dark.png' : '/images/TwitterX_logo--light.png'}
alt="Twitter (X)"
height={24}
width={24}
/>
</a>
<a className="flex" href="https://askaitools.ai" target="_blank" rel="noopener">
<Image src='/images/Jike_logo.png' alt="Jike" height={24} width={24}/>
</a>
</>
);
};
const Nav = () => {
const [isMenuOpen, setIsMenuOpen] = useState(false);
return (
<nav className="relative flex w-full items-center border-b bg-white px-6 lg:px-16 xl:px-20">
<div className="flex-1 flex justify-center md:justify-start p-4 pr-10">
<Logo isDarkMode={false} />
</div>
<div className="hidden md:flex flex-1 justify-end">
<SocialMediaLinks isDarkMode={false} />
</div>
<div className="md:hidden flex items-center">
<button onClick={() => setIsMenuOpen(!isMenuOpen)}>
{isMenuOpen ? <XMarkIcon className="h-6 w-6" /> : <Bars3Icon className="h-6 w-6" />}
</button>
</div>
<div className={`${isMenuOpen ? 'fixed' : 'hidden'} overflow-hidden inset-0 w-screen h-screen bg-white shadow-md z-50`}>
<div className="flex flex-col w-full h-full">
<div className="flex justify-between items-center border-b bbg-scale-300">
<div className="flex justify-center w-full p-4">
<Logo isDarkMode={false} />
</div>
<button onClick={() => setIsMenuOpen(false)} className="pr-10">
<XMarkIcon className="h-6 w-6" />
</button>
</div>
{/* Replace with your actual social media links */}
<div className="flex flex-col overflow-y-auto p-4">
<a href="https://askaitools.ai" target="_blank" rel="noopener" className="p-4 border-b border-gray-600 text-center">Email</a>
<a href="https://askaitools.ai" target="_blank" rel="noopener" className="p-4 border-b border-gray-600 text-center">Twitter</a>
<a href="https://askaitools.ai" target="_blank" rel="noopener" className="p-4 border-b border-gray-600 text-center">Jike</a>
</div>
</div>
</div>
</nav>
);
};
export default Nav;
================================================
FILE: app/components/SectionContainer.tsx
================================================
import classNames from 'classnames'
import { PropsWithChildren } from 'react'
interface SectionContainerProps {
className?: string
}
const SectionContainer = ({ children, className }: PropsWithChildren<SectionContainerProps>) => (
<div
className={classNames(
`container prose prose-sm dark:prose-invert mx-auto max-w-full md:prose-base xl:prose-lg px-6 lg:px-16 xl:px-20 relative py-16 sm:py-18 md:py-24 lg:py-24`,
className
)}
>
{children}
</div>
)
export default SectionContainer
================================================
FILE: app/lib/supabase.ts
================================================
import { createClient } from '@supabase/supabase-js'
const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
)
export default supabase
================================================
FILE: app/lib/theme.tsx
================================================
import { createContext, useContext, useEffect, useState } from 'react'
interface UseThemeProps {
toggleTheme: () => void
}
interface ThemeProviderProps {
children?: any
}
export const ThemeContext = createContext<UseThemeProps>({
toggleTheme: () => {},
})
export const useTheme = () => useContext(ThemeContext)
export const ThemeProvider = ({ children }: ThemeProviderProps) => {
const [isDarkMode, setIsDarkMode] = useState(false)
useEffect(() => {
const key = localStorage.getItem('darkMode')
setIsDarkMode(key === 'true')
}, [])
const toggleTheme = () => {
setIsDarkMode(!isDarkMode)
}
return (
<ThemeContext.Provider
value={{
toggleTheme,
}}
>
{children}
</ThemeContext.Provider>
)
}
================================================
FILE: app/next-env.d.ts
================================================
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
================================================
FILE: app/next.config.js
================================================
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'example.com',
},
],
},
}
================================================
FILE: app/package.json
================================================
{
"name": "askaitools-community-edition",
"version": "0.1.0",
"description": "A cutting-edge search engine project tailored specifically for the AI product",
"license": "Apache License Version 2.0",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"repository": {
"type": "git",
"url": "git+https://github.com/askaitools/askaitools-community-edition.git"
},
"dependencies": {
"@heroicons/react": "^2.1.1",
"@next/third-parties": "^14.1.0",
"@supabase/supabase-js": "^1.33.3",
"@vercel/speed-insights": "^1.0.7",
"classnames": "^2.3.1",
"https-proxy-agent": "^7.0.4",
"marked": "^4.0.12",
"next": "^13.5.6",
"openai": "^4.38.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-github-btn": "^1.4.0",
"react-inlinesvg": "^4.1.3",
"use-debounce": "^7.0.1"
},
"devDependencies": {
"@mertasan/tailwindcss-variables": "^2.2.2",
"@radix-ui/colors": "^0.1.8",
"@tailwindcss/forms": "^0.5.0",
"@tailwindcss/typography": "^0.5.2",
"@types/marked": "^4.0.3",
"@types/node": "^17.0.23",
"@types/react": "^17.0.43",
"autoprefixer": "^10.4.4",
"deepmerge": "^4.2.2",
"mini-svg-data-uri": "^1.4.4",
"postcss": "^8.4.12",
"prettier": "^2.6.2",
"prettier-plugin-tailwindcss": "^0.1.8",
"tailwindcss": "^3.0.23",
"tailwindcss-radix": "^1.6.0",
"typescript": "^4.6.3"
}
}
================================================
FILE: app/pages/_app.tsx
================================================
import type { AppProps } from 'next/app'
import { ThemeProvider } from '~/lib/theme'
import '../styles/globals.css'
import React from "react";
function MyApp({ Component, pageProps }: AppProps) {
return (
<>
<ThemeProvider>
<Component {...pageProps} />
</ThemeProvider>
</>
)
}
export default MyApp
================================================
FILE: app/pages/api/embedding_search.ts
================================================
import type { NextApiRequest, NextApiResponse } from 'next';
import OpenAI from 'openai';
// import { HttpsProxyAgent } from 'https-proxy-agent';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method === 'POST') {
try {
const openai = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'],
// httpAgent: new HttpsProxyAgent(process.env.HTTP_PROXY!),
});
const search = req.body.search;
const embeddingResponse = await openai.embeddings.create({
input: search,
model: 'text-embedding-3-small',
encoding_format: "float",
dimensions: 512,
});
const embedding = embeddingResponse.data[0].embedding;
res.status(200).json({ embedding });
} catch (error) {
res.status(500).json({ error: 'Error processing your request' });
}
} else {
res.setHeader('Allow', ['POST']);
res.status(405).end(`Method ${req.method} Not Allowed`);
}
}
================================================
FILE: app/pages/index.tsx
================================================
import Head from 'next/head'
import React, {useState} from 'react'
import Layout from '~/components/Layout'
import ItemsTileGrid from '~/components/ItemsTileGrid'
import SectionContainer from '~/components/SectionContainer'
import supabase from '~/lib/supabase'
import {Items} from '~/types/items'
interface Props {
items: Items[]
}
function normalizeSearch(search:string) {
let result = search.substring(0, 256).replace(/[\p{P}\p{S}]/gu, ' ').toLowerCase();
result = result.trim().replace(/\s+/g, ' ');
return result;
}
async function embeddingSearch(search:string) {
try {
const response = await fetch('/api/embedding_search', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ search }),
});
if (response.ok) {
const embeddingData = await response.json();
const searchEmbedding = embeddingData.embedding;
const { error: matchError, data: embeddingItems } = await supabase.rpc(
'match_items',
{
query_embedding: searchEmbedding,
match_threshold: 0, // Fill in an appropriate value based on your requirements
match_count: 10, // Fill in an appropriate value based on your requirements
}
);
if (matchError) {
return [];
} else {
return embeddingItems;
}
} else {
return [];
}
} catch (error) {
return [];
}
}
async function ftsSearch(search:string) {
const { error: matchError, data: FTSitems } = await supabase.rpc(
'fts_match_items_ranked', {
query_string: search.replace(/ /g, ' & '), // Modify the query string as needed
match_count: 10, // Fill in an appropriate value based on your requirements
})
if (matchError) {
return [];
} else {
return FTSitems;
}
}
function asyncFunctionWithTimeout(asyncFunction: (...args: any[]) => Promise<any>, timeout:number, ...args :any[]) {
const timeoutPromise = new Promise((_, reject) => {
setTimeout(() => {
reject(new Error('Async function timed out'));
}, timeout);
});
return Promise.race([asyncFunction(...args), timeoutPromise]);
}
function dedupeSortedItemsByDomain(sortedItems: Items[]): Items[] {
const uniqueDomains = new Set();
return sortedItems.filter((item) => {
const url = new URL(item.url);
const domain = url.hostname;
if (uniqueDomains.has(domain)) {
return false;
} else {
uniqueDomains.add(domain);
return true;
}
});
}
function Home(props: Props) {
const [items, setItems] = useState<Items[]>([])
const metaTitle = 'Your meta title'
const metaDescription = `Your meta description`
const [search, setSearch] = useState('')
const [isSearching, setIsSearching] = useState(false)
const [afterSearch, setAfterSearch] = useState(false)
const handleSearchSubmit = async (e: { preventDefault: () => void }) => {
e.preventDefault();
if (search.trim() === '') {
setIsSearching(false)
setItems([])
return
}
setIsSearching(true);
const normalizedSearch = normalizeSearch(search);
const [embeddingResult, ftsResult] = await Promise.allSettled([
asyncFunctionWithTimeout(embeddingSearch, 3000, normalizedSearch),
asyncFunctionWithTimeout(ftsSearch, 3000, normalizedSearch),
]);
const embeddingItems = embeddingResult.status === 'fulfilled' ? embeddingResult.value : [];
const FTSitems = ftsResult.status === 'fulfilled' ? ftsResult.value : [];
// Modify the scoring function according to your requirements.
function calculateScore(item: any, isFTS: boolean, isEmbedding: boolean) {
const keywordMatchScore = isFTS ? item.rank : 0;
const semanticMatchScore = isEmbedding ? item.similarity : 0;
const trafficScore = Math.log10(item.visitstotalcount > 5000 ? item.visitstotalcount : 2500);
return trafficScore * (semanticMatchScore + keywordMatchScore);
}
const mergedItemsMap = new Map();
embeddingItems.forEach((item:Items) => {
mergedItemsMap.set(item.url, { ...item, score: calculateScore(item, false, true) });
});
FTSitems.forEach((item:Items) => {
if (mergedItemsMap.has(item.url)) {
const existingItem = mergedItemsMap.get(item.url);
const updatedItem = { ...existingItem, rank: item.rank };
updatedItem.score = calculateScore(updatedItem, true, true);
mergedItemsMap.set(item.url, updatedItem);
} else {
mergedItemsMap.set(item.url, { ...item, score: calculateScore(item, true, false) });
}
});
const sortedItems = Array.from(mergedItemsMap.values()).sort((a, b) => b.score - a.score)
const dedupedSortedItems = dedupeSortedItemsByDomain(sortedItems);
const page1 = dedupedSortedItems.slice(0, 100);
if (page1) {
setItems(page1)
}
setIsSearching(false)
setAfterSearch(true)
};
return (
<>
<Head>
<title>{`${metaTitle} | Your Product's Name`}</title>
<meta name="description" content={metaDescription}></meta>
<link rel="icon" href="/favicon.ico" type="image/x-icon"/>
</Head>
<Layout>
<SectionContainer className="space-y-4">
<div className="text-center">
<h1 className="h1">
{metaTitle}
<div className="mt-4">
<span className="text-blue-500">{metaDescription}</span>
</div>
</h1>
</div>
<form className="md:w-2/3 mx-auto" onSubmit={handleSearchSubmit}>
<label
className="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"
htmlFor="search"
>
Search
</label>
<div className="relative">
<div className="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
<svg
aria-hidden="true"
className="w-5 h-5 text-gray-600 dark:text-gray-400"
fill="none"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1"
/>
</svg>
</div>
<input
className="block w-full bg-gray-50 p-2 ps-10 text-md text-gray-900 placeholder-gray-500 border border-gray-500 rounded-lg ring-1 ring-transparent focus:outline-none focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
id="search"
autoComplete="off"
placeholder="Search..."
required
type="search"
value={search}
onChange={(e) => setSearch(e.target.value)}
/>
</div>
</form>
{isSearching ? (
<div className="flex justify-center pt-16">
<img src="/images/blocks-wave.svg" className="h-16 w-16" alt="Loading..." />
</div>
) : (
<div className="grid space-y-0 md:gap-8 lg:grid-cols-12 lg:gap-16 lg:space-y-0 xl:gap-16">
<div className="lg:col-start-3 lg:col-span-8 xl:col-start-3 xl:col-span-8">
<div className="text-xs">
{afterSearch && (
<p>About {items.length} results</p>
)}
</div>
<div className="grid space-y-10">
{items.length ? (
<ItemsTileGrid searchResults={items}/>
) : (
afterSearch ? (
<h3 className="h3">No results found, please try another keyword.</h3>
):null
)}
</div>
</div>
</div>
)}
</SectionContainer>
</Layout>
</>
)
}
export default Home
================================================
FILE: app/postcss.config.js
================================================
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
================================================
FILE: app/prettier.config.js
================================================
module.exports = {
singleQuote: true,
semi: false,
}
================================================
FILE: app/styles/globals.css
================================================
@tailwind base;
@tailwind components;
@tailwind utilities;
html {
scroll-behavior: smooth;
}
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.section--masked {
}
::selection {
background-color: #93c5fd;
color: #333 !important;
}
.section--bg-masked {
position: absolute;
width: 100%;
height: 100%;
}
.section-container {
position: relative;
z-index: 1;
display: flex;
justify-content: center;
}
.dark .auth-container {
background-color: #181818;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23313131' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.dark .header--light {
display: none;
}
.header--dark {
display: none;
}
.dark .header--dark {
display: block;
}
================================================
FILE: app/tailwind.config.js
================================================
module.exports = {
content: [
'./components/**/*.tsx',
'./pages/**/*.tsx',
],
darkMode: 'class',
theme: {
extend: {
typography: (theme) => ({
DEFAULT: {
css: {
a: {
textDecoration: 'none',
},
},
},
}),
backdropFilter: {
'none': 'none',
'blur': 'blur(20px)',
},
fontFamily: {
sans: [
'custom-font',
'Helvetica Neue',
'Helvetica',
'Arial',
'sans-serif',
],
mono: ['Source Code Pro', 'Menlo', 'monospace'],
},
keyframes: {
'flash-code': {
'0%': { backgroundColor: 'rgba(63, 207, 142, 0.1)' },
'100%': { backgroundColor: 'transparent' },
},
},
animation: {
'flash-code': 'flash-code 1s forwards',
'flash-code-slow': 'flash-code 2s forwards',
},
},
},
plugins: [require('@tailwindcss/typography')],
}
================================================
FILE: app/tsconfig.json
================================================
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"~/*": ["./*"],
"react": [ "./node_modules/@types/react" ]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
================================================
FILE: app/types/items.ts
================================================
export interface Items {
id: number
url: string
title: string
brief?: string
tsv?: any
doc_embedding?: any
logo?: string
visitstotalcount?: bigint
bouncerate?: number
pagespervisit?: number
visitsavgdurationformatted?: string
similarity?: number
rank?: number
}
================================================
FILE: supabase/migrations/20240506_init.sql
================================================
create table
items ( -- Replace the "items" table with your own table name.
id bigint generated by default as identity primary key,
url text not null unique,
title text not null,
brief text,
tsv tsvector generated always as (
setweight(to_tsvector('english', coalesce(title,'')), 'A') ||
setweight(to_tsvector('english', coalesce(brief,'')), 'B')
) stored,
doc_embedding vector(512),
logo text,
visitstotalcount bigint,
bouncerate float,
pagespervisit float,
visitsavgdurationformatted text,
created_at timestamp with time zone default timezone ('utc'::text, now()) not null
);
alter table
items enable row level security;
create policy
"Enable public read access" on items for
select
using (true);
create or replace function match_items(
query_embedding vector(512),
match_threshold float,
match_count int
)
returns table (
id bigint,
url text,
title text,
brief text,
logo text,
visitstotalcount bigint,
bouncerate float,
pagespervisit float,
visitsavgdurationformatted text,
similarity float
)
language plpgsql
as $$
begin
return query
select
items.id,
items.url,
items.title,
items.brief,
items.logo,
items.visitstotalcount,
items.bouncerate,
items.pagespervisit,
items.visitsavgdurationformatted,
1 - (items.doc_embedding <=> query_embedding) as similarity
from items
where
1 - (items.doc_embedding <=> query_embedding) > match_threshold
order by items.doc_embedding <=> query_embedding
limit match_count;
end;
$$;
create or replace function fts_match_items_ranked(
query_string text,
match_count int
)
returns table (
id bigint,
url text,
title text,
brief text,
logo text,
visitstotalcount bigint,
bouncerate float,
pagespervisit float,
visitsavgdurationformatted text,
rank float
)
language plpgsql
as $$
begin
return query
select
items.id,
items.url,
items.title,
items.brief,
items.logo,
items.visitstotalcount,
items.bouncerate,
items.pagespervisit,
items.visitsavgdurationformatted,
ts_rank_cd(items.tsv, to_tsquery(query_string)) as rank
from
items
where
items.tsv @@ to_tsquery(query_string)
order by
rank DESC
limit
match_count;
end;
$$;
gitextract_fkoby6mu/
├── .gitignore
├── LICENSE
├── NOTICE.txt
├── README.md
├── README_CN.md
├── app/
│ ├── .gitignore
│ ├── components/
│ │ ├── Footer.tsx
│ │ ├── ItemsTileGrid.tsx
│ │ ├── Layout.tsx
│ │ ├── LogoImage.tsx
│ │ ├── Nav.tsx
│ │ └── SectionContainer.tsx
│ ├── lib/
│ │ ├── supabase.ts
│ │ └── theme.tsx
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── package.json
│ ├── pages/
│ │ ├── _app.tsx
│ │ ├── api/
│ │ │ └── embedding_search.ts
│ │ └── index.tsx
│ ├── postcss.config.js
│ ├── prettier.config.js
│ ├── styles/
│ │ └── globals.css
│ ├── tailwind.config.js
│ ├── tsconfig.json
│ └── types/
│ └── items.ts
└── supabase/
└── migrations/
└── 20240506_init.sql
SYMBOL INDEX (19 symbols across 10 files)
FILE: app/components/ItemsTileGrid.tsx
function PartnerTileGrid (line 5) | function PartnerTileGrid({
FILE: app/components/Layout.tsx
type LayoutProps (line 5) | type LayoutProps = {}
FILE: app/components/Nav.tsx
type LogoProps (line 6) | interface LogoProps {
FILE: app/components/SectionContainer.tsx
type SectionContainerProps (line 4) | interface SectionContainerProps {
FILE: app/lib/theme.tsx
type UseThemeProps (line 3) | interface UseThemeProps {
type ThemeProviderProps (line 7) | interface ThemeProviderProps {
FILE: app/pages/_app.tsx
function MyApp (line 6) | function MyApp({ Component, pageProps }: AppProps) {
FILE: app/pages/api/embedding_search.ts
function handler (line 5) | async function handler(req: NextApiRequest, res: NextApiResponse) {
FILE: app/pages/index.tsx
type Props (line 9) | interface Props {
function normalizeSearch (line 13) | function normalizeSearch(search:string) {
function embeddingSearch (line 19) | async function embeddingSearch(search:string) {
function ftsSearch (line 54) | async function ftsSearch(search:string) {
function asyncFunctionWithTimeout (line 67) | function asyncFunctionWithTimeout(asyncFunction: (...args: any[]) => Pro...
function dedupeSortedItemsByDomain (line 77) | function dedupeSortedItemsByDomain(sortedItems: Items[]): Items[] {
function Home (line 92) | function Home(props: Props) {
FILE: app/types/items.ts
type Items (line 2) | interface Items {
FILE: supabase/migrations/20240506_init.sql
type items (line 1) | create table
function match_items (line 28) | create or replace function match_items(
function fts_match_items_ranked (line 68) | create or replace function fts_match_items_ranked(
Condensed preview — 27 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (56K chars).
[
{
"path": ".gitignore",
"chars": 22,
"preview": "/node_modules/\n/.idea/"
},
{
"path": "LICENSE",
"chars": 11356,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "NOTICE.txt",
"chars": 364,
"preview": "Copyright 2024 AskAITools\n\nIn addition to the terms of the Apache License 2.0, any derivative works or projects based on"
},
{
"path": "README.md",
"chars": 3883,
"preview": "# AskAITools Community Edition\n\n## Overview\n\nAskAITools (https://askaitools.ai) is a cutting-edge search engine project "
},
{
"path": "README_CN.md",
"chars": 1620,
"preview": "# AskAITools 开源社区版\n\n## 概述\n\nAskAITools (https://askaitools.ai) 是专为 AI 产品领域设计的顶级搜索引擎项目,致力于打造 AI 产品领域中最卓越的搜索引擎。我们的目标是为用户提供最"
},
{
"path": "app/.gitignore",
"chars": 453,
"preview": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pn"
},
{
"path": "app/components/Footer.tsx",
"chars": 805,
"preview": "import GitHubButton from 'react-github-btn'\n\nconst Footer = () => {\n return (\n <footer className=\"flex fle"
},
{
"path": "app/components/ItemsTileGrid.tsx",
"chars": 4549,
"preview": "import Link from 'next/link'\nimport {Items} from '~/types/items'\nimport LogoImage from './LogoImage';\n\nexport default fu"
},
{
"path": "app/components/Layout.tsx",
"chars": 891,
"preview": "import {PropsWithChildren, useEffect, useState} from 'react'\nimport Nav from './Nav'\nimport Footer from './Footer'\n\ntype"
},
{
"path": "app/components/LogoImage.tsx",
"chars": 1472,
"preview": "import React, { useState } from 'react';\nimport Image from 'next/image';\n\nconst LogoImage: React.FC<{ logo: string | und"
},
{
"path": "app/components/Nav.tsx",
"chars": 3889,
"preview": "import Image from 'next/image';\nimport Link from 'next/link';\nimport {useState} from 'react';\nimport { Bars3Icon, XMarkI"
},
{
"path": "app/components/SectionContainer.tsx",
"chars": 517,
"preview": "import classNames from 'classnames'\nimport { PropsWithChildren } from 'react'\n\ninterface SectionContainerProps {\n class"
},
{
"path": "app/lib/supabase.ts",
"chars": 198,
"preview": "import { createClient } from '@supabase/supabase-js'\n\nconst supabase = createClient(\n process.env.NEXT_PUBLIC_SUPABASE_"
},
{
"path": "app/lib/theme.tsx",
"chars": 766,
"preview": "import { createContext, useContext, useEffect, useState } from 'react'\n\ninterface UseThemeProps {\n toggleTheme: () => v"
},
{
"path": "app/next-env.d.ts",
"chars": 201,
"preview": "/// <reference types=\"next\" />\n/// <reference types=\"next/image-types/global\" />\n\n// NOTE: This file should not be edite"
},
{
"path": "app/next.config.js",
"chars": 210,
"preview": "/** @type {import('next').NextConfig} */\nmodule.exports = {\n reactStrictMode: true,\n images: {\n remotePatterns: [\n "
},
{
"path": "app/package.json",
"chars": 1451,
"preview": "{\n \"name\": \"askaitools-community-edition\",\n \"version\": \"0.1.0\",\n \"description\": \"A cutting-edge search engine project"
},
{
"path": "app/pages/_app.tsx",
"chars": 341,
"preview": "import type { AppProps } from 'next/app'\nimport { ThemeProvider } from '~/lib/theme'\nimport '../styles/globals.css'\nimpo"
},
{
"path": "app/pages/api/embedding_search.ts",
"chars": 1108,
"preview": "import type { NextApiRequest, NextApiResponse } from 'next';\nimport OpenAI from 'openai';\n// import { HttpsProxyAgent } "
},
{
"path": "app/pages/index.tsx",
"chars": 10193,
"preview": "import Head from 'next/head'\nimport React, {useState} from 'react'\nimport Layout from '~/components/Layout'\nimport Items"
},
{
"path": "app/postcss.config.js",
"chars": 82,
"preview": "module.exports = {\n plugins: {\n tailwindcss: {},\n autoprefixer: {},\n },\n}\n"
},
{
"path": "app/prettier.config.js",
"chars": 57,
"preview": "module.exports = {\n singleQuote: true,\n semi: false,\n}\n"
},
{
"path": "app/styles/globals.css",
"chars": 2360,
"preview": "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\nhtml {\n scroll-behavior: smooth;\n}\n\nbody {\n -webkit-font-s"
},
{
"path": "app/tailwind.config.js",
"chars": 1000,
"preview": "module.exports = {\n content: [\n './components/**/*.tsx',\n './pages/**/*.tsx',\n ],\n darkMode: 'class',\n theme: "
},
{
"path": "app/tsconfig.json",
"chars": 622,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"es5\",\n \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n \"allowJs\": true,\n \"sk"
},
{
"path": "app/types/items.ts",
"chars": 315,
"preview": "\nexport interface Items {\n id: number\n url: string\n title: string\n brief?: string\n tsv?: any\n doc_embe"
},
{
"path": "supabase/migrations/20240506_init.sql",
"chars": 2353,
"preview": "create table\n items ( -- Replace the \"items\" table with your own table name.\n id bigint generated by default as ide"
}
]
About this extraction
This page contains the full source code of the askaitools/askaitools-community-edition GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 27 files (49.9 KB), approximately 13.2k tokens, and a symbol index with 19 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.