Skip to content

Commit a746cb9

Browse files
committed
update
1 parent ba640e7 commit a746cb9

File tree

26 files changed

+548
-689
lines changed

26 files changed

+548
-689
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
pytest:
13+
runs-on: ubuntu-latest
14+
services:
15+
mailhog:
16+
image: mailhog/mailhog:latest
17+
ports:
18+
- 1025:1025 # SMTP
19+
openai:
20+
image: tidedra/mock_openai:latest
21+
ports:
22+
- 30000:30000
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6
26+
27+
- name: Setup uv
28+
uses: astral-sh/setup-uv@v7.1.4
29+
30+
31+
- name: Run Pytest
32+
env:
33+
ZOTERO_ID: "0"
34+
ZOTERO_KEY: "AbCdEfGhIjKlMnOpQrStUvWx"
35+
SENDER: "test@example.com"
36+
RECEIVER: "test@example.com"
37+
SENDER_PASSWORD: "test"
38+
OPENAI_API_KEY: "sk-xxx"
39+
OPENAI_API_BASE: "http://openai:30000/v1"
40+
run: |
41+
uv run pytest

.github/workflows/main.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,27 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout
12-
uses: actions/checkout@v4
13-
with:
14-
repository: ${{ vars.REPOSITORY }}
15-
ref: ${{ vars.REF }}
12+
uses: actions/checkout@v6
13+
# with:
14+
# repository: ${{ vars.REPOSITORY }}
15+
# ref: ${{ vars.REF }}
1616

1717
- name: Setup uv
18-
uses: astral-sh/setup-uv@v3
19-
with:
20-
version: '0.5.4'
18+
uses: astral-sh/setup-uv@v7.1.4
19+
2120

2221
- name: Run script
2322
env:
2423
ZOTERO_ID: ${{ secrets.ZOTERO_ID }}
2524
ZOTERO_KEY: ${{ secrets.ZOTERO_KEY }}
26-
ZOTERO_IGNORE: ${{ vars.ZOTERO_IGNORE }}
27-
SEND_EMPTY: ${{ vars.SEND_EMPTY }}
28-
ARXIV_QUERY: ${{ secrets.ARXIV_QUERY }}
29-
SMTP_SERVER: ${{ secrets.SMTP_SERVER }}
30-
SMTP_PORT: ${{ secrets.SMTP_PORT }}
3125
SENDER: ${{ secrets.SENDER }}
3226
RECEIVER: ${{ secrets.RECEIVER }}
3327
SENDER_PASSWORD: ${{ secrets.SENDER_PASSWORD }}
34-
MAX_PAPER_NUM: ${{ secrets.MAX_PAPER_NUM }}
35-
USE_LLM_API: ${{ secrets.USE_LLM_API }}
3628
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3729
OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE }}
38-
MODEL_NAME: ${{ secrets.MODEL_NAME }}
39-
LANGUAGE: ${{ vars.LANGUAGE }}
30+
CUSTOM_CONFIG: ${{ vars.CUSTOM_CONFIG }}
4031
run: |
41-
uv run main.py
32+
printf "%b\n" "$CUSTOM_CONFIG" > config/custom.yaml
33+
echo "Use custom config: "
34+
cat config/custom.yaml
35+
uv run src/zotero_arxiv_daily/main.py

.github/workflows/test.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test workflow
1+
name: Test
22
on:
33
workflow_dispatch:
44

@@ -7,33 +7,28 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v4
11-
with:
12-
repository: ${{ vars.REPOSITORY }}
13-
ref: ${{ vars.REF }}
10+
uses: actions/checkout@v6
11+
# with:
12+
# repository: ${{ vars.REPOSITORY }}
13+
# ref: ${{ vars.REF }}
1414

1515
- name: Setup uv
16-
uses: astral-sh/setup-uv@v3
17-
with:
18-
version: '0.5.4'
16+
uses: astral-sh/setup-uv@v7.1.4
17+
1918

2019
- name: Run script
2120
env:
2221
ZOTERO_ID: ${{ secrets.ZOTERO_ID }}
2322
ZOTERO_KEY: ${{ secrets.ZOTERO_KEY }}
24-
ZOTERO_IGNORE: ${{ vars.ZOTERO_IGNORE }}
25-
ARXIV_QUERY: ${{ secrets.ARXIV_QUERY }}
26-
SEND_EMPTY: ${{ vars.SEND_EMPTY }}
27-
SMTP_SERVER: ${{ secrets.SMTP_SERVER }}
28-
SMTP_PORT: ${{ secrets.SMTP_PORT }}
2923
SENDER: ${{ secrets.SENDER }}
3024
RECEIVER: ${{ secrets.RECEIVER }}
3125
SENDER_PASSWORD: ${{ secrets.SENDER_PASSWORD }}
32-
MAX_PAPER_NUM: ${{ secrets.MAX_PAPER_NUM }}
33-
USE_LLM_API: ${{ secrets.USE_LLM_API }}
3426
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3527
OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE }}
36-
MODEL_NAME: ${{ secrets.MODEL_NAME }}
37-
LANGUAGE: ${{ vars.LANGUAGE }}
28+
CUSTOM_CONFIG: ${{ vars.CUSTOM_CONFIG }}
3829
run: |
39-
uv run main.py --debug
30+
export DEBUG=true
31+
printf "%b\n" "$CUSTOM_CONFIG" > config/custom.yaml
32+
echo "Use custom config: "
33+
cat config/custom.yaml
34+
uv run src/zotero_arxiv_daily/main.py

config/base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ llm:
2222
generation_kwargs:
2323
max_tokens: 16384
2424
temperature: 0.4
25-
model: gpt-4o-mini
25+
model: ???
2626
language: English
2727

2828
reranker:

config/custom.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
zotero:
2+
user_id: ${oc.env:ZOTERO_ID}
3+
api_key: ${oc.env:ZOTERO_KEY}
4+
include_path: null
5+
6+
email:
7+
sender: ${oc.env:SENDER}
8+
receiver: ${oc.env:RECEIVER}
9+
smtp_server: smtp.qq.com
10+
smtp_port: 465
11+
sender_password: ${oc.env:SENDER_PASSWORD}
12+
13+
llm:
14+
api:
15+
key: ${oc.env:OPENAI_API_KEY}
16+
base_url: ${oc.env:OPENAI_API_BASE}
17+
generation_kwargs:
18+
model: gpt-4o-mini
19+
20+
reranker:
21+
local:
22+
model: Qwen/Qwen3-Embedding-0.6B
23+
api:
24+
key: ${oc.env:OPENAI_API_KEY}
25+
base_url: ${oc.env:OPENAI_API_BASE}
26+
model: text-embedding-3-large
27+
28+
source:
29+
arxiv:
30+
query: cs.AI+cs.CV+cs.LG+cs.CL
31+
32+
executor:
33+
debug: ${oc.env:DEBUG,false}
34+
source: ['arxiv']

config/default.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
defaults:
22
- base
3-
- private
4-
- public
3+
- custom

config/public.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,21 @@ dependencies = [
1818
"pyzotero>=1.6.11",
1919
"scikit-learn>=1.7.1",
2020
"sentence-transformers>=5.0.0",
21+
"torch",
2122
"openai>=1.99.1",
22-
"llama-cpp-python>=0.3.2",
2323
"arxiv>=2.2.0",
24+
"pymupdf4llm>=0.2.7",
25+
"pymupdf-layout>=1.26.6",
2426
]
2527

28+
[tool.uv.sources]
29+
torch = { index = "pytorch" }
30+
31+
[[tool.uv.index]]
32+
name = "pytorch"
33+
url = "https://download.pytorch.org/whl/cpu"
34+
explicit = true
35+
2636
[dependency-groups]
2737
dev = [
2838
"ipykernel>=7.1.0",

src/zotero_arxiv_daily/executor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,16 @@ def filter_corpus(self, corpus:list[CorpusPaper]) -> list[CorpusPaper]:
5252
new_corpus.append(c)
5353
samples = random.sample(new_corpus, min(5, len(new_corpus)))
5454
samples = '\n'.join([c.title + ' - ' + '\n'.join(c.paths) for c in samples])
55-
logger.info(f"Selected {len(new_corpus)} zotero papers:\n{samples}")
55+
logger.info(f"Selected {len(new_corpus)} zotero papers:\n{samples}\n...")
5656
return new_corpus
5757

5858

5959
def run(self):
6060
corpus = self.fetch_zotero_corpus()
6161
corpus = self.filter_corpus(corpus)
62+
if len(corpus) == 0:
63+
logger.error(f"No zotero papers found. Please check your zotero settings:\n{self.config.zotero}")
64+
return
6265
all_papers = []
6366
for source, retriever in self.retrievers.items():
6467
logger.info(f"Retrieving {source} papers...")

src/zotero_arxiv_daily/llm.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)