Skip to content

Commit

Permalink
migrate auth interface from ai backend to gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
sunjiayu committed Jun 23, 2024
1 parent 5af1c4f commit 18e3523
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 100 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
sed -i "s/OSS_ACCESS_KEY_ID/${{ secrets.OSS_ACCESS_KEY_ID }}/g" ./conf/auth.yaml
sed -i "s/OSS_ACCESS_KEY_SECRET/${{ secrets.OSS_ACCESS_KEY_SECRET }}/g" ./conf/auth.yaml
sed -i "s/OPENAI_API_KEY/${{ secrets.OPENAI_API_KEY }}/g" ./conf/auth.yaml
sed -i "s/TOKEN_WX_APPID/${{ secrets.TOKEN_WX_APPID }}/g" ./conf/auth.yaml
sed -i "s/TOKEN_WX_SECRET/${{ secrets.TOKEN_WX_SECRET }}/g" ./conf/auth.yaml
bazel build --action_env=CC=clang-14 //...
mkdir -p output/bin output/conf
mv ./bazel-bin/src/ielts_ai output/bin/
Expand Down
2 changes: 0 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ bazel_dep(name = "abseil-cpp", version = "20240116.2")
bazel_dep(name = "boost.scope_exit", version = "1.83.0.bzl.1")
bazel_dep(name = "boringssl", version = "0.0.0-20240530-2db0eb3")
bazel_dep(name = "c-ares", version = "1.16.1")
# bazel_dep(name = "cpp-httplib", version = "0.7.15")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "gazelle", version = "0.37.0")
bazel_dep(name = "grpc", version = "1.62.1", repo_name = "com_github_grpc_grpc")
bazel_dep(name = "nlohmann_json", version = "3.11.3")
bazel_dep(name = "rules_foreign_cc", version = "0.9.0")
Expand Down
20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1 @@
# openai-grpc-server

## 1. Install dependencies required by grpc-gateway.

## 2. Generate gRPC stubs

```
protoc -I . \
--go_out ./ --go_opt paths=source_relative \
--go-grpc_out ./ --go-grpc_opt paths=source_relative \
proto/chat_completion/chat_completion.proto
```

## 3. Generate reverse-proxy using protoc-gen-grpc-gateway

```
protoc -I . --grpc-gateway_out ./ \
--grpc-gateway_opt paths=source_relative \
--grpc-gateway_opt generate_unbound_methods=true \
proto/chat_completion/chat_completion.proto
```
7 changes: 0 additions & 7 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ http_archive(
urls = ["https://github.com/pkusunjy/openai-server-proto/archive/v1.1.6.tar.gz"],
)

http_archive(
name = "tacopie",
sha256 = "bbdebecdb68d5f9eb64170217000daf844e0aee18b8c4d3dd373d07efd9f7316",
strip_prefix = "tacopie-master",
url = "https://github.com/cylix/tacopie/archive/master.zip",
)

http_archive(
name = "com_github_aliyun_oss_sdk",
build_file = "//bazel:aliyun_oss_sdk.BUILD",
Expand Down
2 changes: 0 additions & 2 deletions conf/auth.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
openai_api_key: OPENAI_API_KEY
wx_appid: TOKEN_WX_APPID
wx_secret: TOKEN_WX_SECRET
oss_endpoint: OSS_ACCESS_ENDPOINT
oss_access_key_id: OSS_ACCESS_KEY_ID
oss_access_key_secret: OSS_ACCESS_KEY_SECRET
1 change: 0 additions & 1 deletion src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ cc_binary(
"//src/plugin:log_sink",
"//src/plugin:oss",
"//src/plugin:token",
"//src/service:auth",
"//src/service:ielts_ai",
"@abseil-cpp//absl/flags:flag",
"@abseil-cpp//absl/flags:parse",
Expand Down
5 changes: 0 additions & 5 deletions src/ielts_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "liboai.h"
#include "src/plugin/log_sink.h"
#include "src/plugin/token.h"
#include "src/service/auth.h"
#include "src/service/ielts_ai.h"

ABSL_FLAG(uint16_t, port, 8123, "Server port for the service");
Expand Down Expand Up @@ -69,10 +68,6 @@ int32_t main(int32_t argc, char* argv[]) {
builder.AddListeningPort(server_addr, grpc::SslServerCredentials(ssl_opts));
}

// auth
auth::AuthImpl auth_service;
builder.RegisterService(&auth_service);

// chat
chat_completion::IeltsAI chat_service;
if (chat_service.initialize() != 0) {
Expand Down
16 changes: 0 additions & 16 deletions src/service/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@ package(
default_visibility = ["//:__subpackages__"],
)

cc_library(
name = "auth",
srcs = [
"auth.cpp",
],
hdrs = [
"auth.h",
],
deps = [
"//src/plugin:token",
"@com_github_grpc_grpc//:grpc++",
"@com_github_grpc_grpc//:grpc++_reflection",
"@com_github_pkusunjy_openai_server_proto//:auth_cc_grpc",
],
)

cc_library(
name = "ielts_ai",
srcs = [
Expand Down
26 changes: 0 additions & 26 deletions src/service/auth.cpp

This file was deleted.

19 changes: 0 additions & 19 deletions src/service/auth.h

This file was deleted.

0 comments on commit 18e3523

Please sign in to comment.