Git Product home page Git Product logo

sc-web's Introduction

SC-Web

About

SC-Web is an intelligent knowledge base user interface. Currently, it is a part of the OSTIS Web Platform.

The long term idea of this project is to create a universal rendering mechanism for interfaces defined inside knowledge bases.

Demo

sc-web-demo

Quick start

We provide the ostis/sc-web Docker image to simplify the integration of this UI with existing ostis-systems.

# Connect to remote sc-server (or another Docker container)
docker run --rm -it -p 8000:8000 ostis/sc-web:latest --server_host=<ip or hostname>
# Connect to server hosted on localhost
docker run --rm -it --network=host ostis/sc-web:latest

Installation

Clone repo:

git clone https://github.com/ostis-ai/sc-web --recursive
cd sc-web

If you're using Ubuntu, you can install node and python runtimes using our script:

./scripts/install_dependencies.sh

Otherwise, the following dependencies should be installed:

  • python3
  • pip
  • nodejs
  • npm
  • grunt-cli
  • python modules: tornado, sqlalchemy, numpy, configparser, py-sc-client

Node.js and Python libraries can be installed using the respective package managers

pip3 install -r requirements.txt
npm install

Build the frontend

./scripts/build_sc_web.sh

Run the server

Note: SC-Web backend requires sc-server to be up and running, check ./run_scweb.sh --help for network configuration options.

Use the included script to launch the backend server:

./scripts/run_sc_web.sh

The UI will listen at localhost:8000.

Development notes

To run grunt in watch mode use:

npm run serve

Watch mode supports livereload. To enable livereload uncomment in client/templates/common.html

<!-- Enable livereload script for development -->
-<!--<script type="text/javascript" charset="utf-8" src="http://localhost:35729/livereload.js"></script>-->
+<script type="text/javascript" charset="utf-8" src="http://localhost:35729/livereload.js"></script>

Documentation

Full documentation, including:

  • core concepts
  • rationale behind the sc-web
  • system design
  • software interfaces

is redistributed in a form of the SCn-TeX document (always links to the latest version of the document).

Alternatively, you can build sc-web documentation only. To do that, refer to the scn-latex-plugin documentation.

sc-web's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sc-web's Issues

Переход из меню в меню

По моему мнению, окна меню можно было бы улучшить. В большинстве случаев для перехода в нужное место нам нужно перейти из раздела в раздел. И это удобно, однако не всегда. Например, когда в одном разделе есть только один пукт. Мы хотим перейти в этот раздел, но мы не можем по нему кликнуть. Для пояснения моих слов прикрепляю картинку ниже.
need
В данном случаем мы делаем один лишний клик, для того, чтобы перейти туда, куда нам нужно.

Npm not installed by install_deps script

Describe the bug
There is no npm and nodejs installation in scripts, because of that sc-web work incorrectly. Maybe #30 connected with this problem.

To Reproduce
Steps to reproduce the behavior:

  1. Go to sc-web/scripts
  2. Run ./run_scweb.sh
  3. See error

Expected behavior
Normal working sc-web

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser chrome

UnboundLocalError: local variable 'lang_addr' referenced before assignment

Describe the bug

if lang_arg:
lang_addr = ScAddr(int(lang_arg))

The lang_addr variable is declared only in case of lang_arg's existence, but is referenced later regardless.

if lang_addr:
construction.create_edge(sc_types.EDGE_ACCESS_CONST_POS_PERM, 'trans_cmd_addr', lang_addr, 'arc_addr_4')

To Reproduce
Steps to reproduce the behavior:

  1. Make a (regular) POST request to /api/question/answer/translate/ with no lang parameter passed.
  2. See error

Expected behavior
Either a success response or a response indicating that "lang is a required parameter" or "some required parameters are missing".

Duplicate questions to entities

Describe the bug
There is a duplication of possible questions to the entity.

To Reproduce
Steps to reproduce the behavior:

  1. Go to main page.
  2. Right-click on any entity.
    Screenshot from 2022-09-26 14-41-07
  3. See error

Expected behavior
List of questions without duplication

Desktop (please complete the following information):

  • OS:Ubuntu 20.04
  • Browser Chrome Version 104.0.5112.101 (Official Build) (64-bit)

Version of sc-web: f67a8c4e

Server responds HTTP 500 and doesn't heal if connection to `sc-server` was lost

Describe the bug
The only way to make sc-web work again after it lost connection to sc-server is to restart app.py, connections loss causes an UncaughtException:

[E 220818 11:16:16 web:1798] Uncaught exception GET /api/user/ (172.17.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8000', method='GET', uri='/api/user/', version='HTTP/1.1', remote_ip='172.17.0.1')
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/tornado/web.py", line 1711, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/sc-web/server/decorators.py", line 28, in wrapper
        return func(*argv)
      File "/sc-web/server/handlers/api.py", line 389, in get
        user_addr = sc_session.get_sc_addr()
      File "/sc-web/server/decorators.py", line 28, in wrapper
        return func(*argv)
      File "/sc-web/server/handlers/api_logic.py", line 759, in get_sc_addr
        self.sc_addr = self._session_get_sc_addr()
      File "/sc-web/server/handlers/api_logic.py", line 878, in _session_get_sc_addr
        return self._find_user_by_system_idtf("session::" + str(self.session_key))
      File "/sc-web/server/handlers/api_logic.py", line 856, in _find_user_by_system_idtf
        value = client.resolve_keynodes(ScIdtfResolveParams(idtf=idtf, type=None))[0]
      File "/usr/local/lib/python3.8/dist-packages/sc_client/client/_api.py", line 67, in resolve_keynodes
        return session.execute(common.ClientCommand.KEYNODES, *params)
      File "/usr/local/lib/python3.8/dist-packages/sc_client/session.py", line 150, in execute
        return _ScClientSession.executor.run(request_type, *args)
      File "/usr/local/lib/python3.8/dist-packages/sc_client/client/_executor.py", line 29, in run
        response = session.send_message(self._executor_mapper.get(command_type), payload)
      File "/usr/local/lib/python3.8/dist-packages/sc_client/session.py", line 121, in send_message
        raise BrokenPipeError
    BrokenPipeError
[E 220818 11:16:16 web:2271] 500 GET /api/user/ (172.17.0.1) 1.16ms

To Reproduce
Steps to reproduce the behavior:

  1. Start sc-server
  2. Start sc-web
  3. Check that the page works
  4. Restart sc-server
  5. You will get HTTP 500
  6. Page will no longer be able to load properly

Expected behavior
In case the connection to sc-server was lost there should be an attempt to restore it, transparently to the user side. In other words, we should handle the BrokenPipe exception.

Desktop (please complete the following information):

  • OS: macOS 13 Ventura
  • Browser: Chromium
  • Runtime: Docker

Missing check on addArcEventRequest

Describe the bug
If element is created and connected to structure with common arc then it will be displayed as if it is connected using access edge

To Reproduce
Steps to reproduce the behavior:

  1. Add to kb next code
test_structure = [*
    test_source => nrel_test_relation: test_target;;
*];;

sc_node_norole_relation -> nrel_test_relation;;
test_structure -> test_source;;
  1. Build kb, navigate to test_structure and open it in two windows
  2. In first window press blue eye to turn on scg view
  3. In second window turn on expert mode, switch to scg-code and add some outgoing EdgeDCommonConst, for example some idtf(first image)
  4. Switch back to first window and this idtf will be added to structure view (second image)

Expected behavior
Only elements connected via access edge are added to structure view.

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser chrome

Inability to add an existing node to the structure

Describe the bug
It is not possible to add a node existing in the knowledge base to a structure in the scg-mode. Instead, new nodes are created.

To Reproduce
Steps to reproduce the behavior:

  1. Go to main page.

  2. Type real_entity in search and open it in scg-mode.
    Screenshot from 2022-09-26 12-41-38

  3. Try to add question_initiated or any other node.
    Screenshot from 2022-09-26 12-46-12

Expected behavior
The selected node is added to the structure.

Actual behavior
The selection button does not work, you cannot add a node from the knowledge base

Desktop (please complete the following information):

  • OS:Ubuntu 20.04
  • Browser Chrome Version 104.0.5112.101 (Official Build) (64-bit)

Version of sc-web: f67a8c4e

Shebang in install.sh

Describe the bug
No shebang in install.sh script file.

Expected behavior
Add shebang to install.sh script file like in install_deps_ubuntu.sh or like in run_scweb.sh

Wrong language in expert mode

Describe the bug
When in expert mode ui displays wrong identifiers

To Reproduce
Steps to reproduce the behavior:

  1. Go to ims
  2. Switch language to English
  3. Turn on expert mode
  4. Identifiers will show Russian text instead of English

Expected behavior
Identifiers remain in English

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser chrome

The layout of the search hint window breaks

Describe the bug
The layout of the search hint window breaks after request to the element with large semantic neighborhood

To Reproduce
Steps to reproduce the behavior:

  1. Go to main page
  2. Type binary_custom in search and open it
    image
  3. Back to previous page
    image
  4. Type 'set' in search input

Expected behavior
image

Actual behavior
image

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser Chrome Version 105.0.5195.52 (Official Build) (64-bit)

Version of sc-web: 79e434e

Update CONTRIB documentation

Is your feature request related to a problem? Please describe.
Please add documentation for contributors.

Describe the solution you'd like
File CONTRIBUTING.md like in ostis-ai/sc-machine.

sc-server URL is hardcoded on the client-side

Describe the bug
File client/js/Core/main.js contains a hardcoded link to sc-server. It makes it impossible for the frontend to connect to sc-server if it is not deployed on the same machine (most server-side projects fall under this category)

To Reproduce
Steps to reproduce the behavior:

  1. Change the default port of sc-server and run it
  2. Run sc-web's app.py with the changed server_port flag
  3. Open web interface
  4. You'll observe empty interface and connection errors in browser logs. It will still try to use the default port on the frontend.

Expected behavior
We should be able to change sc-server url at either build time or runtime of the frontend.

Additional context
We could use https://gruntjs.com/api/grunt.template to inject the link at build time and dotenv js package to get it from the .env file.

This may be undesirable for the sc-web Docker container, because it doesn't rebuild sc-web on launch. We could leave a template in the static directory and construct a final js file with the link at runtime using app.py and additional --public_url flag (or something along those lines), that'd be a better solution overall

Spamming 404

Describe the bug
404 error when sc-web starts. It is not crushing the system but spamming 404

To Reproduce
Steps to reproduce the behavior:

  1. Go to sc-web/scripts
  2. Run ./run_scweb.sh
  3. See error

Expected behavior
No errors in console when sc-web is running

Screenshots
image

Desktop (please complete the following information):

  • OS: Linux mint 20.3
  • Browser chrome

В скрипте /ostis-ai/sc-web можно исправить

Проверка файла formats.sh: Проверьте, существует ли файл formats.sh перед его источником с помощью [ -f "${CURRENT_DIR}/formats.sh" ], чтобы избежать ошибки, если файл отсутствует или не доступен для чтения.

Проверка переменной ${SC_WEB_PATH}: Проверьте, установлена ли переменная ${SC_WEB_PATH} перед источником файла set_vars.sh с помощью [ -z "${SC_WEB_PATH}" ]. Это позволит избежать повторной установки переменных, если они уже были заданы.

Обработка ошибок: Добавьте обработку ошибок и выход из скрипта в случае возникновения ошибок. Для этого можно использовать set -eo pipefail, чтобы скрипт автоматически останавливался при возникновении ошибок.

Комментарии: Добавьте комментарии к коду, чтобы пояснить его функциональность и логику. Это поможет другим разработчикам (и вам самим в будущем) лучше понять код.

Логирование: Добавьте логирование, чтобы отслеживать процесс выполнения скрипта и сообщать о его прогрессе или возможных проблемах.

Версия Node.js: Убедитесь, что у вас установлена правильная версия Node.js для сборки проекта sc-web.

Temporal edge doesn't display

Describe the bug
The temporal arc is not shown when asking the semantic neighborhood of a dialogue or message in the example. It is visible only if you ask the access arc from the dialogue to the message

To Reproduce
Steps to reproduce the behavior:

  1. Create construction like a ~> b with agent or using scg-editor
  2. Ask what is a or b
  3. See there is no temporal arc

Expected behavior
See the temporal arc

Screenshots
image
image

Error when displaying reflexive set

Describe the bug
If there is a reflexive set in kb then scg view contains triangle not attached to anything

To Reproduce
Steps to reproduce the behavior:

  1. add to kb something like some_reflexive_set -> some_reflexive_set;;
  2. build kb
  3. run scserver and sc-web
  4. navigate to some_reflexive_set via search, switch to scg-code and observe triangle

Expected behavior
it'll be good to see reflexive edge

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser chrome

Constructs in SCn-code tab are not updated after changes in SCg-code

Describe the bug
After edition in SCg-code tab we have not equal sc-construction in SCn-code and SCg-code tabs

To Reproduce
Steps to reproduce the behavior:

  1. Open main page of sc-web
  2. Enable expert mode
  3. Open SCg tab
  4. Draw new sc-construction to start sc-element
  5. Translate new sc-constructions to KB
  6. Open SCn tab

Expected behavior
New sc-construction are present in the semantic neighborhood of start sc-element

Screenshots
ew sc-construction aren't present in the semantic neighborhood of start sc-element

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser Chrome

Missing check on removeArcEventRequest

Describe the bug
If structure has more then one access edge into any element and one of those edges is removed then this element is removed from scg view but it appears after page reload.

To Reproduce
Steps to reproduce the behavior:

  1. Add to kb next file
test_structure = [*
    test_source => nrel_test_relation: test_target;;
*];;

sc_node_norole_relation -> nrel_test_relation;;
test_structure -> test_source;;
  1. Build kb, navigate to test_structure and open it two times
  2. In first window press blue eye to open scg view of structure (first image)
  3. In second window enable expert mode, turn on scg-code, remove one of edges between test_structure and test_source (second image)
  4. Switch to first window and see that test_source is removed from scg view (third image)

Expected behavior
Elements are not deleted from structure view until all access edges are removed between structure and element

Screenshots
first tab before

deleting edge on second tab

first tab after

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser chrome

Protocol and address are hard-coded for backend sc-server url

Describe the bug
The code in question is this line

To Reproduce
Try to connect to sc-server on a separate host that uses https and/or requires accessing a subpath

Expected behavior
I should be able to either fully rewrite a server URL which is used by the backend or control the subpath and protocol using separate flags.

Knowledge base dependency

Describe the bug
We need to create all sc-web components from knowledge base. Now there are several hardcoded elements: search panel, history panel, expert mode button, language switch button etc.

Expert mode button in the current state includes ALL the panel with other elements.

Expected behavior
sc-web is only an interpreter of interface model represented in sc-code

Desktop (please complete the following information):

  • OS: any
  • Browser: any

Temporal relations are not displayed in SCn and SCg

Describe the bug
If we have an arc that goes from node A to node B and specify that it's some kind of a relation (e.g. role relation) and make this relation temporal, the relation will not be displayed in SCn. The relations are displayed if they're permanent.

image

Such relations may not be displayed in SCg either. Here's a screenshot of the same construction.

image

Expected behavior
Temporal relations are displayed in SCn and SCg.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.