Skip to content

Commit

Permalink
refactor: update error guide message
Browse files Browse the repository at this point in the history
  • Loading branch information
jschang19 committed Dec 16, 2023
1 parent e44835c commit cacde17
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@
const int STORY_NUM=5;

int main(int args,char** argv){
//API token as argument
// check if argument is passed
std::cout << "\033[2J\033[H";
System::Game game;
if(args<2){
std::cout<<"Please provide the API token as argument"<<std::endl;
game.print("沒有 OpenAI API Key,請在參數後方輸入你的 API key","r", true);
game.print("範例:./ChatGPT <YOUR_API_KEY>");
game.print("請至 https://platform.openai.com/api-keys 取得 API key");
return 0;
}
System::Game game;

game.print("\U0001F389 歡迎來到 NTU 模擬器!","w", true);
game.checkStatus(argv[1]);
std::cout<<std::endl;

game.count=STORY_NUM;
OpenAI::ChatGPT chatGpt{argv[1]};
game.printWelcome();
// get random story ids
std::vector<int> story_ids = game.getRandStoryIds(STORY_NUM);
game.story_ids = story_ids;
Expand Down

0 comments on commit cacde17

Please sign in to comment.