[TCT][Tool][Non-ACR] Support options added in tool 33/306833/2
authorUtkarsh Tiwari <utk.tiwari@samsung.com>
Wed, 28 Feb 2024 06:10:14 +0000 (11:40 +0530)
committerUtkarsh Tiwari <utk.tiwari@samsung.com>
Wed, 28 Feb 2024 06:46:00 +0000 (12:16 +0530)
Change-Id: I7b0f954492ef377997bd689e749140c6bed873d5
Signed-off-by: Utkarsh Tiwari <utk.tiwari@samsung.com>
tool/TC_Assistant_Tool/data_TCT.json
tool/TC_Assistant_Tool/log_debugger.py [new file with mode: 0644]
tool/TC_Assistant_Tool/modelweight.pth
tool/TC_Assistant_Tool/newdata.csv
tool/TC_Assistant_Tool/tct_assistance.py
tool/TC_Assistant_Tool/trainedmodel.py

index 8a596a9..f589a3c 100644 (file)
       "responses": [\r
         "Do you want to add Pre and Post condition APIs for the above APIs?\n(Yes or No)\n\n[ To navigate, please type 'Back' ]"\r
       ]\r
+    },\r
+    {\r
+      "tag": "supportsys",\r
+      "patterns": ["Support", "I want support for issue"],\r
+      "responses": [\r
+        "Please select among below options :\n\na. Build issue\nb. Install issue\nc. Environment setup\nd. Rootstrap installation\ne. Some other issue\n\n[ To navigate, please type 'Back' ]"\r
+      ]\r
+    },\r
+    {\r
+      "tag": "envsetupsupport",\r
+      "patterns": ["I need help for environment setup", "I want support for setup issue"],\r
+      "responses": [\r
+        "Environment Setup \n\na. Download and Install TizenStudio (Tizen Studio 3.7) from : https://developer.tizen.org/development/tizen-studio/download\nb. Install JAVA 8/9 using ITVOC\nc. One TizenStudio is installed,Launch Package Manager\n- In Package Manager make below changes :\n- Package Repository : http://107.110.2.162/packages\n- Distribution : tizen_studio_5.5\n [As we update/install rootstrap using package-manager on Linux machine]\nd. Check 5.5 emulator is launching and working fine or not.\n\n[ To navigate, please type 'Back' ]"\r
+      ]\r
+    },\r
+    {\r
+      "tag": "rootstrapsupport",\r
+      "patterns": ["I need help for installing rootstrap", "I want support for rootstrap installation issue"],\r
+      "responses": [\r
+        "Rootstrap installation guide/steps:\n\na. Download sdk-build repo code:\ngit clone ssh://[user-id]@review.tizen.org:29418/sdk/tools/sdk-build -b tizen ~/sdk-build\ngit checkout tizen\nexport PATH=~/sdk-build:$PATH'\n\nb. Install 'add-ons' (Only in case on tizeniot. Do not refer this point (b) for mobile, wearable )\nadd-ons download path: http://10.113.245.23/download/tct/template/tizeniot/\ncommand: ~/sdk-build/pkg-cli install-file -P <add_on_name> -l ~/tizen-studio --force\n\nc. Install tizeniot rootstrap:\npath: https://bart.sec.samsung.net/artifactory/download-tizen-generic/snapshots/TIZEN/Tizen/Tizen-Unified/\ncommand: ~/sdk-build/pkg-cli install-file -P <rootstrap_zip_name> -l ~/tizen-studio --force\n\n[ To navigate, please type 'Back' ]"\r
+      ]\r
+    },\r
+    {\r
+      "tag": "buildsupport",\r
+      "patterns": ["I need help regarding build issue", "I want support for build related issue"],\r
+      "responses": [\r
+        "Please enter build error lines in the textbox below to analyze themin the form of LOG: BUILD_FAIL_LOGS\n\n[ To navigate, please type 'Back' ]"\r
+      ]\r
+    },\r
+    {\r
+      "tag": "buildlogdebug",\r
+      "patterns": ["Build Logs:"],\r
+      "responses": [\r
+        "Build fail may be due to many reasons like implicit declaration, keystore password error etc\n\n[ To navigate, please type 'Back' ]"\r
+      ]\r
+    },\r
+    {\r
+      "tag": "installsupport",\r
+      "patterns": ["I need help regarding install isuue"],\r
+      "responses": [\r
+        "Install fail may be due to many reasons like python version, TPK not present in workspace etc. Kindly follow the below steps to solve the issue :-\n\n- Check if python version is greater than 3.0, if not upgrade the version\n\n- Check if TPK is created inside workspace folder, if not try build again\n\n[ To navigate, please type 'Back' ]"\r
+      ]\r
     }\r
   ]\r
 }\r
diff --git a/tool/TC_Assistant_Tool/log_debugger.py b/tool/TC_Assistant_Tool/log_debugger.py
new file mode 100644 (file)
index 0000000..843e224
--- /dev/null
@@ -0,0 +1,54 @@
+import re
+
+TEST_PROFILE_ERROR = """TEST PROFILE ERROR
+
+Kindly follow below mentioned steps to solve this error -:
+
+1) Remove all certificates from '/tizen-studio-data/keystore/author'
+   sri@a:~/tizen-studio-data/keystore/author$ ls
+   author.p12 test1.p12 test.p12
+   sri@a:~/tizen-studio-data/keystore/author$ sudo rm -rf *.*
+
+2) Create Certificate:
+   sri@a:~/tizen-studio-data/keystore/author$ sudo tizen certificate -a test -p test1234
+
+3) Add certificate in profile
+   sri@a:~/tizen-studio-data/keystore/author$ sudo tizen security-profiles add -n test -a ~/tizen-studio-data/keystore/author/author.p12 -p test1234
+
+4) Now, run your tpkbuild command. It should work.
+   If above solution does not work then copy 'tizen-studio-data' folder from some working Linux machine. But this is not recommended."""
+
+KEYSTRORE_PASSWORD_ERROR = """KEYSTORE PASSWORD ERROR
+
+Kindly follow below mentioned steps to solve this error -:
+
+run below command first before tpkbuild command:
+   "sudo env | grep -i DBUS_SESSION_BUS_ADDRESS | sed 's/^[A-Z_]*=\(.*\)/\1/' > ~/tizen-studio/tools/certificate-encryptor/.secret"
+
+If accessing linux machine using putty then follow below steps:
+
+1) Extract the address of the dbus-session-bus from the arguments of dbus-daemon:
+   ps -ef | grep "dbus-daemon --fork --session --address"
+
+2) Set DBUS_SESSION_BUS_ADDRESS=<address>
+[ Above step 1 and 2 are given at: https://developer.tizen.org/ko/community/tip-tech/how-manage-certificates-and-package-applications-different-ubuntu-setups?langredirect=1 ]
+
+3) From above link, follow step 1 and 2 under "Manage certificates through remote login"
+
+4) Create a file named ".secret" and place it in ~/tizen-studio/tools/certificate-encryptor
+
+5) Copy the value of DBUS_SESSION_BUS_ADDRESS in the .secret file and save."""
+
+def build_log_debug(BUILD_LOG_TEXT):
+    if 'invalid type argument' in BUILD_LOG_TEXT:
+        fail_reason_capture =  'INVALID ARGUMENT ERROR'
+
+    elif "java.io.IOException: Not found a specified profile: test" in BUILD_LOG_TEXT:
+        fail_reason_capture = TEST_PROFILE_ERROR
+    
+    elif "java.io.IOException: keystore password was incorrect" in BUILD_LOG_TEXT:
+        fail_reason_capture = KEYSTRORE_PASSWORD_ERROR
+
+    else:
+        fail_reason_capture = "OOPS !! We couldn't find relevant solution for your error. Kindly refer to the guide for solution :)"
+    return fail_reason_capture
\ No newline at end of file
index 23f4b5e..d9e59ec 100755 (executable)
Binary files a/tool/TC_Assistant_Tool/modelweight.pth and b/tool/TC_Assistant_Tool/modelweight.pth differ
index b778526..1184916 100755 (executable)
 119,Pre:yaca,prepostinfo
 120,PRE:yaca,prepostinfo
 121,Module name:yaca,modulename
+122,Support,supportsys
+123,I want support for issue,supportsys
+124,Environment Setup,envsetupsupport
+125,Need help for environment setup,envsetupsupport
+126,Installing rootstrap,rootstrapsupport
+127,Need help for installing rootstrap,rootstrapsupport
+128,Build Issue,buildsupport
+129,I want support for build related issue,buildsupport
+130,Logs:,buildlogdebug
+131,log:,buildlogdebug
+132,Install issue,installsupport
+133,I want help regarding install issue,installsupport
+134,Need support,supportsys
+135,Support Assistant,supportsys
+136,i need to add a new module,newmodule
index 76f4e77..1dd1b9e 100644 (file)
@@ -31,6 +31,7 @@ from enum_finder import *
 from CMakeFileUpdate import *\r
 from new_module_addition import *\r
 from header_file_location import *\r
+from log_debugger import *\r
 import numpy as np\r
 import pandas as pd\r
 import re\r
@@ -292,6 +293,8 @@ def get_response(message):
             intent="prepostinfo"\r
         else:\r
             intent = get_prediction(message)\r
+            # print("message ", message)\r
+            # print("intent ", intent)\r
         log_info_save(logger, "Intent", intent)\r
     except:\r
         log_create(logger, "Error occurred in get_prediction function")\r
@@ -330,6 +333,29 @@ def get_response(message):
                     return "exit"\r
                 get_response(msg)\r
 \r
+        elif previous_intent == "supportsys" and (message == "back" or message == "Back"):\r
+            msg = "support"\r
+            previous_intent = "goback"\r
+            get_response(msg)\r
+\r
+        elif message == 'a' or message == 'b' or message == 'c' or message == 'd' or message == 'e' or message == '' or message == "exit" or message == "EXIT" or message == "Exit":\r
+            # if previous_intent == "entry":\r
+            previous_intent = "supportsys"\r
+            if message == 'a':\r
+                msg = "Build Issue"\r
+            if message == 'b':\r
+                msg = "Install Issue"\r
+            if message == 'c':\r
+                msg = "Environment Setup"\r
+            if message == 'd':\r
+                msg = "Installing rootstrap"\r
+            if message == 'e':\r
+                msg = "greetings"\r
+            if message == 'exit' or message == 'EXIT' or message == 'Exit':\r
+                return "exit"\r
+            get_response(msg)\r
+\r
+\r
         elif message.lower() == 'yes' or message.lower() =='no':\r
             #in case when module name typed wrong and suggestion is provided\r
             if previous_intent == 'modulename':\r
@@ -920,7 +946,7 @@ def get_response(message):
             else:\r
                 result = "Build parameters values are not correct" + "\n" + "Please try again.."\r
 \r
-        if intent == "launchtctmgr":\r
+        elif intent == "launchtctmgr":\r
             # print("inside launchtctmgr intent")\r
             bar("Installing...")\r
             execute_params = get_build_parameters(execute_tc_params_text)\r
@@ -933,6 +959,15 @@ def get_response(message):
 \r
             print(output_execute)\r
 \r
+        elif intent == "buildlogdebug":\r
+            build_log = message\r
+            print("BUILD LOG ", build_log)\r
+            print("^^^^^^^^^^^^^^^^^^^^^^^^")\r
+            print(build_log_debug(build_log))\r
+            build_fail_reason = build_log_debug(build_log)\r
+            result = build_fail_reason + "\n\n [ To navigate, please type 'Back' ]"\r
+\r
+\r
         elif intent == "goback":\r
             # print("checking new module value from goback", new_module)\r
             # print("Going back\n")\r
@@ -950,6 +985,13 @@ def get_response(message):
                     ind = ind + 1\r
                 result = result + "\n\n" + "If you wish to EXIT, Please type Exit"\r
 \r
+    except KeyboardInterrupt:\r
+        print('Interrupted')\r
+        exit.__str__()\r
+        try:\r
+            sys.exit(130)\r
+        except SystemExit:\r
+            os._exit(130)\r
     except:\r
         log_create(logger, "Error occurred in get_prediction function")\r
         return "Invalid Input. Please try writing again"\r
@@ -973,6 +1015,10 @@ def copy_text(res):
 def _on_mousewheel(event):\r
     base.yview_scroll(int(-1*(event.delta/120)), "units")\r
 \r
+def quit(event):\r
+    print("you pressed control c")\r
+    base.quit()\r
+\r
 def center(win):\r
     """\r
     centers a tkinter window\r
@@ -1102,7 +1148,7 @@ def helpText():
 def on_closing():\r
     # get yes/no answers\r
     msg = CTkMessagebox(title="Exit?", message="Do you want to close the program?",\r
-                        icon="question", option_1="No", option_2="Yes", option_3="")\r
+                        icon="question", option_1="No", option_2="Yes", option_3="",option_focus=2)\r
     response = msg.get()\r
 \r
     if response=="Yes":\r
@@ -1123,7 +1169,7 @@ center(base)
 ChatLog = Text(base, bd=0, relief=FLAT, bg='#d3d3d3',  highlightthickness=0, font="Arial",wrap=WORD)\r
 ChatLog.pack(fill=BOTH,  expand=True)\r
 \r
-welcomeText = "Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module [Type: 'existing']\n > You can add UTC in new module [Type: 'new']\n"\r
+welcomeText = "Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n"\r
 \r
 log_info_save(logger, "Assitant", welcomeText)\r
 \r
@@ -1162,4 +1208,5 @@ base.protocol("WM_DELETE_WINDOW", on_closing)
 base.bind_all("<MouseWheel>", _on_mousewheel)\r
 EntryBox.bind("<Control-Key-a>", select_all)\r
 EntryBox.bind("<Control-Key-A>", select_all)\r
+base.bind('<Control-c>', quit)\r
 base.mainloop()\r
index c2cddf8..838eeff 100755 (executable)
@@ -111,7 +111,7 @@ try:
             self.relu = nn.ReLU()
             self.fc1 = nn.Linear(768, 512)
             self.fc2 = nn.Linear(512, 256)
-            self.fc3 = nn.Linear(256, 15)
+            self.fc3 = nn.Linear(256, 21)
             self.softmax = nn.LogSoftmax(dim=1)
 
         def forward(self, sent_id, mask):