Coder Social home page Coder Social logo

hkint / chatgemini Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bclswl0827/chatgemini

0.0 0.0 0.0 2.72 MB

ChatGemini is a chatbot that uses Google's Generative AI to generate responses to your messages

Home Page: http://ibcl.us/ChatGemini/

License: MIT License

JavaScript 0.30% PHP 5.79% TypeScript 92.79% CSS 0.29% HTML 0.83%

chatgemini's Introduction

ChatGemini

ChatGemini 是一个基于 Google Gemini 的网页客户端,对标 ChatGPT 3.5,使用逻辑同 ChatGPT 3.5 一致,同时支持在聊天中上传图片,自动调用 Gemini-Pro-Vision 模型进行识图。

本项目还可自定义 Gemini API 服务器地址,用户可将本项目部署至支持 PHP 的服务器或虚拟主机上,或是自行配置 Nginx 反向代理,透过修改 Gemini API 路径,从而在**大陆无障碍使用。

如果你对本项目感兴趣,欢迎 Star 和 Fork。

功能特性

  • 适配移动端
  • 操作逻辑同 ChatGPT
  • 仿 ChatGPT 3.5 界面
  • 支持多轮聊天对话
  • 支持上传图片进行识别
  • 逐字输出(SSE)回应
  • 集成 PHP 版反向代理
  • 自定义 Gemini API 地址
  • 对话内容保存至本地
  • 聊天内容导出(HTML 和 PDF)

演示站点

体验该站点需要翻墙。

ChatGemini

界面预览

移动端点击图片可查看大图。

功能 预览
主界面 主界面
多轮聊天 多轮聊天
附件识图 附件识图
逐字输出回应 逐字输出回应
聊天导出 HTML 聊天导出 HTML
聊天导出 PDF 聊天导出 PDF

应用部署

确保已安装 Node.jsGit,且已经得到 Gemini API 密钥。

有关 Gemini API 的申请,请前往 Google AI Studio

准备工作完成后,执行以下步骤:

  1. 将仓库 clone 至本地
$ git clone https://github.com/bclswl0827/ChatGemini
  1. 进入项目目录
$ cd ChatGemini
  1. 安装依赖
$ npm install
  1. 修改配置

参考下方的 应用配置 章节

  1. 构建项目
$ npm run build
  1. 部署项目

build 目录下的文件部署至服务器或虚拟主机上

应用配置

项目基础配置位于根目录下的 .env 文件中,请创建该文件并根据实际情况进行配置,格式如下:

REACT_APP_GEMINI_API_KEY="你的密钥"

各配置项说明如下:

配置项 必填 可选值 默认值 说明
REACT_APP_GEMINI_API_KEY string 填入申请得到的 Gemini API 密钥
REACT_APP_GEMINI_API_URL string 自定义 Gemini API 地址,具体参考下方说明
REACT_APP_GEMINI_API_SSE true|false true 是否逐字输出 Gemini 回应,即是否使能 SSE
REACT_APP_TITLE_SITE string ChatGemini 站点标题,将显示在浏览器标签页上
REACT_APP_TITLE_HEADER string Gemini Pro 应用名称,显示在应用菜单栏和头部
  • 若要直连 Gemini API,请将 .env 中的 REACT_APP_GEMINI_API_URL 字段留空。
  • 若要使用 Nginx 反向代理,请将 .env 中的 REACT_APP_GEMINI_API_URL 修改为反向代理后的地址,例如 https://example.org/api
  • 若要使用集成的 PHP 反向代理,请将 .env 中的 REACT_APP_GEMINI_API_URL 字段修改为 /gemini.php?token=<访问密码>&path=,其中 <访问密码> 不同于 Gemini API 密钥,需自行于 public/gemini.php 中修改。

若要使用 Nginx 反向代理,路径以 /api 为例,示例如下:

location /api {
    proxy_http_version 1.1;
    proxy_read_timeout 86400s;
    proxy_cache off; # 注意关闭缓存
    proxy_buffering off; # 注意关闭缓冲
    proxy_pass https://generativelanguage.googleapis.com/;
}

开源许可

本项目基于 MIT 协议开源,具体请参阅 LICENSE

chatgemini's People

Contributors

bclswl0827 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.