Skip to content
Projects

LemonQu-GIT/ChatGLM-6B-Engineering

View on GitHub

About

ChatGLM-6B Prompt Engineering Project

Web & App Development

How these counts are measured

Measured star growth

in 24h
0
in 7 days
-1
in 15 days
-2
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README_en_us.md

Original

ChatGLM-6B-Engineering

PRs Welcome

Back End

🌐 Chinese Version | English Version

Introduction

hanks for:

And also add lots of code to adapt ChatGLM-6B.

The UI copies ChatGPT's UI and use stream chat for word for word animation.

The api.py copies this PR to implement stream chat.

Deciding to add langchain to this project for better experience.

Example

Functions

  • Chat with context(Default)
  • Web search(You can also look at WebGLM)
  • Stable Diffusion (Deprecated)
  • Markmap to generate mind map

Deploy

Recommended Environment: Python v3.9.16 (node.js v14.21.3)

Please deploy the following repositories:

Instructions for this repo:

  1. Install requirements

    pip install -r requirements.txt
    
  2. Run ChatGLM-6B API (chat api) (Port 8000)

    python api.py
    
  3. Run ChatGLM-6B API (back end) (Port 8003)

    python front_end.py
    
  4. Install markmap.js

    yarn global add markmap-cli
    
  5. Run Gradio Demo

    python gradio_demo.py
    
  6. (Optional) Run npm (front end) (Port 8080) v14.21.3 (Front end code at: https://github.com/LemonQu-GIT/ChatGLM-6B-Engineering/tree/WebUI)

  npm install -g yarn
  #yarn config set registry https://registry.npm.taobao.org -g
  #yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
  yarn install
  yarn dev

Development

Added plugins, allows users to develop plugins according to their own needs

The principle of running the plugins:

Template

>> ./plugins/demo.py (new)

#coding:utf-8
from plugins.utils import *

# 以下的例子是 当用户的 prompt 中有问候性的语句就会告诉 LLM “我”叫小明的插件

def trigger_words(prompt: str):
	triggers = ['我是','你好']
	for trigger in triggers:
		if trigger in prompt:
			return True
	else:
		return False

def run(prompt: str): # 用户输入的 prompt
	if trigger_words(prompt):
		log("<你想要的日志>", "EVENT")
		# 在此写入处理用户 prompt 的代码
		return {"add": f"已知我叫小明,", "prefix": "", "suffix": ""}

>> ./plugins/__init__.py (add)

from plugins.demo import *
import plugins.demo as demo

>> ./front_end.py (add)

if enable_demo:
        log('Calling demo plugin', 'EVENT')
        demo_resp = demo.run(latest_filename)
        if demo_resp != None:
				add_prompt += demo_resp['add']
                prefix += demo_resp['prefix']
                suffix += demo_resp['suffix']
                log(f"demo plugin finished", "EVENT")

Contact

Email: [email protected]

Will gradually open up the website: https://chat.lemonquapi.tk

Explore related projects

Loading…