1.Fix some typos.

2.Eliminate pep8 warnings.
This commit is contained in:
shaobo 2024-07-09 12:05:40 +08:00
parent 6d9d3c5ad4
commit a714607eaf
10 changed files with 24 additions and 26 deletions

View File

@ -51,7 +51,7 @@ auto_tag_thread = true
[UI] [UI]
# Name of the assistant. # Name of the assistant.
name = "CodeGeeX4 RepoDome" name = "CodeGeeX4 RepoDemo"
# Description of the assistant. This is used for HTML tags. # Description of the assistant. This is used for HTML tags.
description = "CodeGeeX4项目级能力展示" description = "CodeGeeX4项目级能力展示"

View File

@ -1,6 +1,6 @@
# CodeGeeX # CodeGeeX
## Welcome to My Chat Dome Application ## Welcome to My Chat Demo Application
This is a simple demonstration application. This is a simple demonstration application.

View File

@ -21,8 +21,8 @@
1. 克隆仓库到本地 1. 克隆仓库到本地
2. 设置模型可以选择本地模型或者api模型,如果使用本地模型需要到run_local.py里设置local_model_path 2. 设置模型可以选择本地模型或者api模型,如果使用本地模型需要到run_local.py里设置local_model_path
3. 如果要用联网问答需要设置bingsearch API在utils/bingsearch.py中设置bingsearch_api_key 3. 如果要用联网问答需要设置bingsearch API在utils/bingsearch.py中设置bingsearch_api_key
3. 安装依赖:`pip install -r requirements.txt` 4. 安装依赖:`pip install -r requirements.txt`
4. 运行应用:`chainlit run run.py --port 8888` 如果用本地:`chainlit run run_local.py --port 8888` 5. 运行应用:`chainlit run run.py --port 8888` 如果用本地:`chainlit run run_local.py --port 8888`
## 注意 ## 注意

View File

@ -1,6 +1,7 @@
import requests
import json import json
import requests
URL = "" # the url you deploy codegeex service URL = "" # the url you deploy codegeex service

View File

@ -1,7 +1,6 @@
import torch
from pydantic import Field from pydantic import Field
from transformers import AutoModel, AutoTokenizer from transformers import AutoModel, AutoTokenizer
from typing import Iterator
import torch
class CodegeexChatModel: class CodegeexChatModel:
@ -34,7 +33,7 @@ class CodegeexChatModel:
) )
return response return response
except Exception as e: except Exception as e:
return f"error:{e}" return f"error: {e}"
def stream_chat(self, prompt, temperature=0.2, top_p=0.95): def stream_chat(self, prompt, temperature=0.2, top_p=0.95):

View File

@ -21,8 +21,8 @@
1. 克隆仓库到本地 1. 克隆仓库到本地
2. 设置模型可以选择本地模型或者api模型,如果使用本地模型需要到run_local.py里设置local_model_path 2. 设置模型可以选择本地模型或者api模型,如果使用本地模型需要到run_local.py里设置local_model_path
3. 如果要用联网问答需要设置bingsearch API在utils/bingsearch.py中设置bingsearch_api_key 3. 如果要用联网问答需要设置bingsearch API在utils/bingsearch.py中设置bingsearch_api_key
3. 安装依赖:`pip install -r requirements.txt` 4. 安装依赖:`pip install -r requirements.txt`
4. 运行应用:`chainlit run run.py --port 8888` 如果用本地:`chainlit run run_local.py --port 8888` 5. 运行应用:`chainlit run run.py --port 8888` 如果用本地:`chainlit run run_local.py --port 8888`
## 注意 ## 注意

View File

@ -1,13 +1,14 @@
import chainlit as cl import chainlit as cl
from chainlit.input_widget import Slider from chainlit.input_widget import Slider
from llm.api.codegeex4 import codegeex4 from llm.api.codegeex4 import codegeex4
from prompts.base_prompt import ( from prompts.base_prompt import (
judge_task_prompt, judge_task_prompt,
get_cur_base_user_prompt, get_cur_base_user_prompt,
web_judge_task_prompt, web_judge_task_prompt,
) )
from utils.tools import unzip_file, get_project_files_with_content
from utils.bingsearch import bing_search_prompt from utils.bingsearch import bing_search_prompt
from utils.tools import unzip_file, get_project_files_with_content
@cl.set_chat_profiles @cl.set_chat_profiles

View File

@ -1,14 +1,14 @@
import chainlit as cl import chainlit as cl
from chainlit.input_widget import Slider from chainlit.input_widget import Slider
from llm.api.codegeex4 import codegeex4
from llm.local.codegeex4 import CodegeexChatModel
from prompts.base_prompt import ( from prompts.base_prompt import (
judge_task_prompt, judge_task_prompt,
get_cur_base_user_prompt, get_cur_base_user_prompt,
web_judge_task_prompt, web_judge_task_prompt,
) )
from utils.tools import unzip_file, get_project_files_with_content
from utils.bingsearch import bing_search_prompt from utils.bingsearch import bing_search_prompt
from llm.local.codegeex4 import CodegeexChatModel from utils.tools import unzip_file, get_project_files_with_content
local_model_path = "<your_local_model_path>" local_model_path = "<your_local_model_path>"
llm = CodegeexChatModel(local_model_path) llm = CodegeexChatModel(local_model_path)
@ -19,7 +19,7 @@ class StreamProcessor:
self.previous_str = "" self.previous_str = ""
def get_new_part(self, new_str): def get_new_part(self, new_str):
new_part = new_str[len(self.previous_str) :] new_part = new_str[len(self.previous_str):]
self.previous_str = new_str self.previous_str = new_str
return new_part return new_part

View File

@ -1,6 +1,5 @@
import requests import requests
from bs4 import BeautifulSoup as BS4 from bs4 import BeautifulSoup as BS4
import requests
BING_API_KEY = "<your_bing_api_key>" BING_API_KEY = "<your_bing_api_key>"

View File

@ -1,6 +1,6 @@
import zipfile
import os
import json import json
import os
import zipfile
def unzip_file(zip_path, extract_dir): def unzip_file(zip_path, extract_dir):
@ -103,7 +103,6 @@ def filter_data(obj):
"delphi": "{ Delphi }", "delphi": "{ Delphi }",
"scheme": "; Scheme", "scheme": "; Scheme",
"basic": "' Basic", "basic": "' Basic",
"assembly": "; Assembly",
"groovy": "// Groovy", "groovy": "// Groovy",
"abap": "* Abap", "abap": "* Abap",
"gdscript": "# GDScript", "gdscript": "# GDScript",
@ -122,7 +121,6 @@ def filter_data(obj):
"dockerfile": "# Dockerfile", "dockerfile": "# Dockerfile",
"markdown": "<!-- Markdown -->", "markdown": "<!-- Markdown -->",
"cmake": "# CMake", "cmake": "# CMake",
"dockerfile": "# Dockerfile",
} }
programming_languages_to_file_extensions = json.load( programming_languages_to_file_extensions = json.load(