Skip to content

Commit

Permalink
fix setup & inference with plugin bugs (#67)
Browse files Browse the repository at this point in the history
* add LOAD_DEFAULT_DATASET and DEFAULT_DATASET_NAME to .env.production on setup

Signed-off-by: cbh778899 <[email protected]>

* fix bugs crashes app when use system_instruction in plugin

Signed-off-by: cbh778899 <[email protected]>

---------

Signed-off-by: cbh778899 <[email protected]>
  • Loading branch information
cbh778899 committed Aug 25, 2024
1 parent cc23f17 commit 1b7ee2a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ALLOW_ORIGIN="*"
STATIC_API_KEY_ENABLED=0
ENABLE_HTTPS=0
ENABLE_PLUGIN=0
ENABLE_HTTPS=0
HTTPS_KEY_PATH="*/privkey.pem"
HTTPS_CERT_PATH="*/cert.pem"
HTTPS_CA_PATH="*/chain.pem"
SYSTEM_INSTRUCTION="*"
LOAD_DEFAULT_DATASET=0
DEFAULT_DATASET_NAME="production_dataset"
AVAILABLE_APIS="ALL"
2 changes: 1 addition & 1 deletion actions/inference.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export async function chatCompletion(req, res) {
request_body.prompt = formatOpenAIContext(value);
break;
case "system_instruction":
messages.push(value);
messages.push({role:"system", content: value});
break;
case "normal": default:
break;
Expand Down
4 changes: 3 additions & 1 deletion setup/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,14 @@ void saveSettings(int show_message) {
fprintf(f, ENV_PRODUCTION_FILE,
allow_origin_name,
static_api_key_enabled,
https_enabled,
plugin_enabled,
https_enabled,
https_cert_path_container, https_privkey_name,
https_cert_path_container, https_cert_name,
https_cert_path_container, https_ca_name,
system_instruction,
default_dataset_enabled,
default_dataset_name,
api_enabled_str
);
fclose(f);
Expand Down
4 changes: 3 additions & 1 deletion setup/setup_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,14 @@
#define ENV_PRODUCTION_FILE \
"ALLOW_ORIGIN=\"%s\"\n"\
"STATIC_API_KEY_ENABLED=%d\n"\
"ENABLE_HTTPS=%d\n"\
"ENABLE_PLUGIN=%d\n"\
"ENABLE_HTTPS=%d\n"\
"HTTPS_KEY_PATH=\"%s/%s\"\n"\
"HTTPS_CERT_PATH=\"%s/%s\"\n"\
"HTTPS_CA_PATH=\"%s/%s\"\n"\
"SYSTEM_INSTRUCTION=\"%s\"\n"\
"LOAD_DEFAULT_DATASET=%d\n"\
"DEFAULT_DATASET_NAME=\"%s\"\n"\
"AVAILABLE_APIS=\"%s\""

#define AVAILABLE_APIS_FORMAT "%d%d%d%d.%d%d.%d.%d%d.%d"
Expand Down

0 comments on commit 1b7ee2a

Please sign in to comment.