resolve the issue of naive parser (#87)

This commit is contained in:
KevinHuSh
2024-02-29 18:53:02 +08:00
committed by GitHub
parent 28531fc73d
commit 3d4315c42a
7 changed files with 41 additions and 22 deletions

View File

@@ -70,11 +70,10 @@ def github_callback():
}, headers={"Accept": "application/json"})
res = res.json()
if "error" in res:
return get_json_result(data=False, retcode=RetCode.AUTHENTICATION_ERROR,
retmsg=res["error_description"])
return redirect("/?error=%s" % res["error_description"])
if "user:email" not in res["scope"].split(","):
return get_json_result(data=False, retcode=RetCode.AUTHENTICATION_ERROR, retmsg='user:email not in scope')
return redirect("/?error=user:email not in scope")
session["access_token"] = res["access_token"]
session["access_token_from"] = "github"
@@ -104,8 +103,9 @@ def github_callback():
except Exception as e:
rollback_user_registration(user_id)
stat_logger.exception(e)
return redirect("/?error=%s"%str(e))
return redirect("/knowledge")
return redirect("/?auth=%s"%user_id)
def user_info_from_github(access_token):

View File

@@ -85,7 +85,7 @@ def init_llm_factory():
"tags": "LLM,TEXT EMBEDDING,SPEECH2TEXT,MODERATION",
"status": "1",
},{
"name": "AI",
"name": "AI",
"logo": "",
"tags": "LLM,TEXT EMBEDDING,SPEECH2TEXT,MODERATION",
"status": "1",

View File

@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# init env. must be the first import
import logging
import os

View File

@@ -58,7 +58,7 @@ default_llm = {
"image2text_model": "gpt-4-vision-preview",
"asr_model": "whisper-1",
},
"AI": {
"AI": {
"chat_model": "glm-3-turbo",
"embedding_model": "embedding-2",
"image2text_model": "glm-4v",