Skip to content

Commit e98d419

Browse files
authored
Merge pull request #5 from edward-ly/feature/assistant-api
feat: replace example model with TaskProcessing API, rewrite app using `nc_py_api` module
2 parents e805114 + 231f9e0 commit e98d419

File tree

9 files changed

+294
-308
lines changed

9 files changed

+294
-308
lines changed

.github/workflows/pr-feedback.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-FileCopyrightText: 2023 Marcel Klehr <[email protected]>
8+
# SPDX-FileCopyrightText: 2023 Joas Schilling <[email protected]>
9+
# SPDX-FileCopyrightText: 2023 Daniel Kesselberg <[email protected]>
10+
# SPDX-FileCopyrightText: 2023 Florian Steffens <[email protected]>
11+
# SPDX-License-Identifier: MIT
12+
13+
name: 'Ask for feedback on PRs'
14+
on:
15+
schedule:
16+
- cron: '30 1 * * *'
17+
18+
jobs:
19+
pr-feedback:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: The get-github-handles-from-website action
23+
uses: marcelklehr/get-github-handles-from-website-action@a739600f6b91da4957f51db0792697afbb2f143c # v1.0.0
24+
id: scrape
25+
with:
26+
website: 'https://nextcloud.com/team/'
27+
28+
- name: Get blocklist
29+
id: blocklist
30+
run: |
31+
blocklist=$(curl https://raw.githubusercontent.com/nextcloud/.github/master/non-community-usernames.txt | paste -s -d, -)
32+
echo "blocklist=$blocklist" >> "$GITHUB_OUTPUT"
33+
34+
- uses: marcelklehr/pr-feedback-action@1883b38a033fb16f576875e0cf45f98b857655c4
35+
with:
36+
feedback-message: |
37+
Hello there,
38+
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.
39+
40+
We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.
41+
42+
Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6
43+
44+
Thank you for contributing to Nextcloud and we hope to hear from you soon!
45+
46+
(If you believe you should not receive this message, you can add yourself to the [blocklist](https://github.com/nextcloud/.github/blob/master/non-community-usernames.txt).)
47+
days-before-feedback: 14
48+
start-date: '2024-04-30'
49+
exempt-authors: '${{ steps.blocklist.outputs.blocklist }},${{ steps.scrape.outputs.users }}'
50+
exempt-bots: true

.gitignore

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
.DS_Store
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Editor directories and files
8+
.idea
9+
.vscode
10+
*.suo
11+
*.ntvs*
12+
*.njsproj
13+
*.sln
14+
15+
.marginalia
16+
17+
/js/
18+
build/
19+
coverage/
20+
vendor
21+
.php-cs-fixer.cache
22+
.phpunit.result.cache
23+
24+
/out
25+
/dev/
26+
local
27+
tmp
28+
.phpdoc
29+
clover.unit.xml
30+
clover.integration.xml
31+
proto/thrift/gen-*
32+
33+
# Python Part
34+
35+
# Byte-compiled / optimized / DLL files
36+
__pycache__/
37+
*.py[cod]
38+
*$py.class
39+
40+
# Pycharm settings
41+
.idea/
42+
43+
# mypy
44+
.mypy_cache/
45+
.dmypy.json
46+
dmypy.json
47+
48+
# Pyre type checker
49+
.pyre/
50+
51+
# pytype static type analyzer
52+
.pytype/
53+
54+
# Environments
55+
.env
56+
.venv
57+
env/
58+
venv/
59+
ENV/
60+
env.bak/
61+
venv.bak/
62+
63+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
64+
__pypackages__/
65+
66+
# Scrapy stuff:
67+
.scrapy
68+
69+
# Sphinx documentation
70+
docs/_build/
71+
72+
# PyBuilder
73+
.pybuilder/
74+
target/
75+
76+
# Distribution / packaging
77+
.Python
78+
develop-eggs/
79+
dist/
80+
downloads/
81+
eggs/
82+
.eggs/
83+
lib64/
84+
parts/
85+
sdist/
86+
var/
87+
wheels/
88+
share/python-wheels/
89+
*.egg-info/
90+
.installed.cfg
91+
*.egg
92+
MANIFEST
93+
converted/
94+
95+
geckodriver.log

.run/TalkBotAI.run.xml renamed to .run/AssistantTalkBot.run.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<component name="ProjectRunConfigurationManager">
2-
<configuration default="false" name="TalkBotAI" type="PythonConfigurationType" factoryName="Python">
3-
<module name="talk_bot_ai_example" />
2+
<configuration default="false" name="AssistantTalkBot" type="PythonConfigurationType" factoryName="Python">
3+
<module name="talk_bot_ai" />
44
<option name="INTERPRETER_OPTIONS" value="" />
55
<option name="PARENT_ENVS" value="true" />
66
<envs>
77
<env name="AE_VERSION" value="1.0.0" />
8-
<env name="APP_ID" value="talk_bot_ai_example" />
9-
<env name="APP_PERSISTENT_STORAGE" value="$USER_HOME$/persis_storage" />
8+
<env name="APP_ID" value="talk_bot_ai" />
109
<env name="APP_PORT" value="10034" />
1110
<env name="APP_SECRET" value="12345" />
1211
<env name="APP_VERSION" value="1.0.0" />
@@ -28,4 +27,4 @@
2827
<option name="INPUT_FILE" value="" />
2928
<method v="2" />
3029
</configuration>
31-
</component>
30+
</component>

HOW_TO_INSTALL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
How To Install
22
==============
33

4-
1. Install **AppAPI** from [Appstore](https://apps.nextcloud.com/apps/app_api).
4+
1. Install **AppAPI** from the [Appstore](https://apps.nextcloud.com/apps/app_api).
55
2. Create a deployment daemon following the [instructions](https://cloud-py-api.github.io/app_api/CreationOfDeployDaemon.html) provided by AppAPI. _(If you are using AIO, it will be created automatically)_
6-
3. Navigate to the `External Apps` menu from your Nextcloud instance, find this example, and click the `Install` button.
7-
4. Enable this bot in conversation settings.
8-
5. Type in conversation: **@assistant I have a question for you**
6+
3. Navigate to the `External Apps` menu from your Nextcloud instance, find this app, and click `Deploy and Enable`.
7+
4. In Nextcloud Talk, choose a conversation and enable the bot in `Conversation settings`.
8+
5. Now you can invoke the bot by typing `@assistant` followed by a prompt in the conversation (e.g. `@assistant I have a question for you.`).

Makefile

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,88 @@
11
.DEFAULT_GOAL := help
22

3+
APP_ID := talk_bot_ai
4+
JSON_INFO := "{\"id\":\"$(APP_ID)\",\"name\":\"Assistant Talk Bot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":10034,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system\":0}"
5+
36
.PHONY: help
47
help:
5-
@echo "Welcome to TalkBotAI example. Please use \`make <target>\` where <target> is one of"
8+
@echo "Welcome to the Nextcloud Assistant talk bot. Please use \`make <target>\` where <target> is one of"
69
@echo " "
710
@echo " Next commands are only for dev environment with nextcloud-docker-dev!"
811
@echo " They should run from the host you are developing on(with activated venv) and not in the container with Nextcloud!"
912
@echo " "
1013
@echo " build-push build image and upload to ghcr.io"
1114
@echo " "
12-
@echo " run28 install TalkBotAI for Nextcloud 28"
13-
@echo " run27 install TalkBotAI for Nextcloud 27"
15+
@echo " run install nextcloud_talk_bot for Nextcloud Latest"
16+
@echo " run30 install nextcloud_talk_bot for Nextcloud 30"
17+
@echo " run29 install nextcloud_talk_bot for Nextcloud 29"
18+
@echo " run28 install nextcloud_talk_bot for Nextcloud 28"
19+
@echo " run27 install nextcloud_talk_bot for Nextcloud 27"
1420
@echo " "
15-
@echo " For development of this example use PyCharm run configurations. Development is always set for last Nextcloud."
16-
@echo " First run 'TalkBotAI' and then 'make register', after that you can use/debug/develop it and easy test."
21+
@echo " For development of this app use PyCharm run configurations. Development is always set for last Nextcloud."
22+
@echo " First run 'nextcloud_talk_bot' and then 'make register', after that you can use/debug/develop it and easy test."
1723
@echo " "
18-
@echo " register28 perform registration of running 'TalkBotAI' into the 'manual_install' deploy daemon."
19-
@echo " register27 perform registration of running 'TalkBotAI' into the 'manual_install' deploy daemon."
24+
@echo " register perform registration of running 'nextcloud_talk_bot' into the 'manual_install' deploy daemon."
25+
@echo " register30 perform registration of running 'nextcloud_talk_bot' into the 'manual_install' deploy daemon."
26+
@echo " register29 perform registration of running 'nextcloud_talk_bot' into the 'manual_install' deploy daemon."
27+
@echo " register28 perform registration of running 'nextcloud_talk_bot' into the 'manual_install' deploy daemon."
28+
@echo " register27 perform registration of running 'nextcloud_talk_bot' into the 'manual_install' deploy daemon."
2029

2130
.PHONY: build-push
2231
build-push:
2332
docker login ghcr.io
24-
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/talk_bot_ai_example:2.1.0 --tag ghcr.io/cloud-py-api/talk_bot_ai_example:latest .
33+
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/$(APP_ID):2.1.0 --tag ghcr.io/cloud-py-api/$(APP_ID):latest .
34+
35+
.PHONY: run
36+
run:
37+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
38+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --force-scopes \
39+
--info-xml https://raw.githubusercontent.com/cloud-py-api/$(APP_ID)/main/appinfo/info.xml
40+
41+
.PHONY: run30
42+
run30:
43+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
44+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --force-scopes \
45+
--info-xml https://raw.githubusercontent.com/cloud-py-api/$(APP_ID)/main/appinfo/info.xml
46+
47+
.PHONY: run29
48+
run29:
49+
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
50+
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --force-scopes \
51+
--info-xml https://raw.githubusercontent.com/cloud-py-api/$(APP_ID)/main/appinfo/info.xml
2552

2653
.PHONY: run28
2754
run28:
28-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai_example --silent --force || true
29-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot_ai_example --force-scopes \
30-
--info-xml https://raw.githubusercontent.com/cloud-py-api/talk_bot_ai_example/main/appinfo/info.xml
55+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
56+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --force-scopes \
57+
--info-xml https://raw.githubusercontent.com/cloud-py-api/$(APP_ID)/main/appinfo/info.xml
3158

3259
.PHONY: run27
3360
run27:
34-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai_example --silent --force || true
35-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot_ai_example --force-scopes \
36-
--info-xml https://raw.githubusercontent.com/cloud-py-api/talk_bot_ai_example/main/appinfo/info.xml
61+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
62+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --force-scopes \
63+
--info-xml https://raw.githubusercontent.com/cloud-py-api/$(APP_ID)/main/appinfo/info.xml
64+
65+
.PHONY: register
66+
register:
67+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
68+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --force-scopes --wait-finish
69+
70+
.PHONY: register30
71+
register30:
72+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
73+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --force-scopes --wait-finish
74+
75+
.PHONY: register29
76+
register29:
77+
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
78+
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --force-scopes --wait-finish
3779

3880
.PHONY: register28
3981
register28:
40-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai_example --silent --force || true
41-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot_ai_example manual_install --json-info \
42-
"{\"id\":\"talk_bot_ai_example\",\"name\":\"TalkBotAI Example\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":10034,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system\":0}" \
43-
--force-scopes --wait-finish
82+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
83+
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --force-scopes --wait-finish
4484

4585
.PHONY: register27
4686
register27:
47-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai_example --silent --force || true
48-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot_ai_example manual_install --json-info \
49-
"{\"id\":\"talk_bot_ai_example\",\"name\":\"TalkBotAI Example\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":10034,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system\":0}" \
50-
--force-scopes --wait-finish
87+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister $(APP_ID) --silent --force || true
88+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register $(APP_ID) manual_install --json-info $(JSON_INFO) --force-scopes --wait-finish

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
## Nextcloud Talk Bot
1+
## Nextcloud Assistant Talk Bot
22

3-
Demonstration of using [AppAPI](https://github.com/cloud-py-api/app_api) and Talk Bot API.
3+
**A talk bot using [`AppAPI`](https://github.com/cloud-py-api/app_api), Task Processing API, and Talk Bot API.**
44

5-
The bot is capable of stupidly answering questions in chat.
5+
The bot is capable of answering questions in chat depending on the model set by Nextcloud Assistant.
66

7-
This application is an example, the language model used in it is microscopic, which is ideal for an example.
8-
9-
It shouldn't be too difficult to use a more advanced model based on this example and release a full-fledged application.
10-
11-
Refer to [How to install](https://github.com/cloud-py-api/talk_bot_ai_example/blob/main/HOW_TO_INSTALL.md) to try it.
7+
Refer to [How to install](https://github.com/edward-ly/talk_bot_ai/blob/main/HOW_TO_INSTALL.md) to install the application.

appinfo/info.xml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
11
<?xml version="1.0"?>
22
<info>
3-
<id>talk_bot_ai_example</id>
4-
<name>TalkBotAI Example</name>
5-
<summary>Nextcloud TalkBotAI Example</summary>
3+
<id>talk_bot_ai</id>
4+
<name>Assistant Talk Bot</name>
5+
<summary>Nextcloud Assistant Talk Bot</summary>
66
<description>
77
<![CDATA[
8-
**Demonstration of using [`AppAPI`](https://github.com/cloud-py-api/app_api) and Talk Bot API.**
8+
**A talk bot using [`AppAPI`](https://github.com/cloud-py-api/app_api), Task Processing API, and Talk Bot API.**
99
10-
The bot is capable of stupidly answering questions in chat.
10+
The bot is capable of answering questions in chat depending on the model set by Nextcloud Assistant.
1111
12-
This application is an example, the language model used in it is microscopic, which is ideal for an example.
13-
14-
It shouldn't be too difficult to use a more advanced model based on this example and release a full-fledged application.
15-
16-
Refer to [How to install](https://github.com/cloud-py-api/talk_bot_ai_example/blob/main/HOW_TO_INSTALL.md) to try it.
12+
Refer to [How to install](https://github.com/edward-ly/talk_bot_ai/blob/main/HOW_TO_INSTALL.md) to install the application.
1713
]]></description>
18-
<version>2.1.0</version>
14+
<version>1.0.0</version>
1915
<licence>MIT</licence>
2016
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
2117
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>
22-
<namespace>TalkBotAIExample</namespace>
18+
<author mail="[email protected]" homepage="https://github.com/edward-ly">Edward Ly</author>
19+
<namespace>AssistantTalkBot</namespace>
2320
<category>tools</category>
24-
<screenshot>https://raw.githubusercontent.com/cloud-py-api/talk_bot_ai_example/main/screenshots/talk_bot_ai.png</screenshot>
25-
<website>https://github.com/cloud-py-api/talk_bot_ai_example</website>
26-
<bugs>https://github.com/cloud-py-api/talk_bot_ai_example/issues</bugs>
27-
<repository type="git">https://github.com/cloud-py-api/talk_bot_ai_example.git</repository>
21+
<screenshot>https://raw.githubusercontent.com/edward-ly/talk_bot_ai/main/screenshots/talk_bot_ai.png</screenshot>
22+
<website>https://github.com/edward-ly/talk_bot_ai</website>
23+
<bugs>https://github.com/edward-ly/talk_bot_ai/issues</bugs>
24+
<repository type="git">https://github.com/edward-ly/talk_bot_ai.git</repository>
2825
<dependencies>
29-
<nextcloud min-version="27" max-version="29"/>
26+
<nextcloud min-version="30" max-version="31"/>
3027
</dependencies>
3128
<external-app>
3229
<docker-install>
3330
<registry>ghcr.io</registry>
34-
<image>cloud-py-api/talk_bot_ai_example</image>
35-
<image-tag>2.1.0</image-tag>
31+
<image>edward-ly/talk_bot_ai</image>
32+
<image-tag>1.0.0</image-tag>
3633
</docker-install>
3734
<scopes>
3835
<value>TALK</value>

requirements.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
pydantic>=2.1.1
2-
requests>=2.31
3-
xmltodict>=0.13
4-
httpx>=0.24.1
5-
fastapi>=0.101
6-
uvicorn[standard]>=0.23.2
7-
transformers[torch]>=4.33
8-
tqdm
1+
nc_py_api[app]>=0.16.0

0 commit comments

Comments
 (0)