Skip to content

Commit 1140401

Browse files
committed
Move logic to setup Search Index in own GitHub Action
1 parent cdadca8 commit 1140401

File tree

2 files changed

+68
-47
lines changed

2 files changed

+68
-47
lines changed

.github/workflows/search-index-update.yml

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -66,53 +66,6 @@ jobs:
6666
docker run -i --env-file typesense-scraper-updated.env -e "CONFIG=$(cat typesense-scraper-config.json | jq -r tostring)" typesense/docsearch-scraper
6767
curl 'http://172.17.0.2:8108/keys' -X POST -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -H 'Content-Type: application/json' -d '{"value": "N4N8bF0XwyvzwCGwm3CKB0QcnwyWtygo","description": "Search only","actions": ["documents:search"],"collections":["*"]}'
6868
69-
# Create conversation store collection
70-
curl 'http://172.17.0.2:8108/collections' \
71-
-X POST \
72-
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
73-
-H 'Content-Type: application/json' \
74-
-d '{
75-
"name": "conversation_store",
76-
"fields": [
77-
{
78-
"name": "conversation_id",
79-
"type": "string"
80-
},
81-
{
82-
"name": "model_id",
83-
"type": "string"
84-
},
85-
{
86-
"name": "timestamp",
87-
"type": "int32"
88-
},
89-
{
90-
"name": "role",
91-
"type": "string",
92-
"index": false
93-
},
94-
{
95-
"name": "message",
96-
"type": "string",
97-
"index": false
98-
}
99-
]
100-
}'
101-
102-
# Create or update conversation model
103-
curl 'http://172.17.0.2:8108/conversations/models' \
104-
-X POST \
105-
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
106-
-H 'Content-Type: application/json' \
107-
-d '{
108-
"id": "conv-model-1",
109-
"model_name": "google/gemini-flash-latest",
110-
"history_collection": "conversation_store",
111-
"api_key": "'"${GOOGLE_API_KEY}"'",
112-
"system_prompt": "You are an intelligent assistant for question-answering about ServiceStack Software. Try to answer questions using the provided context. If a response has no references in the provided context, politely say you do not have knowledge about that topic.",
113-
"max_bytes": 16384
114-
}'
115-
11669
- name: repository name fix and env
11770
run: |
11871
echo "letsencrypt_email=${{ secrets.LETSENCRYPT_EMAIL }}" >> $GITHUB_ENV
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Setup Search Index
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build Search Index"]
6+
types:
7+
- completed
8+
workflow_dispatch:
9+
10+
jobs:
11+
init-conversation-store:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Create conversation store collection
15+
env:
16+
TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_API_KEY }}
17+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
18+
run: |
19+
curl 'https://search.docs.servicestack.net/collections' \
20+
-X POST \
21+
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
22+
-H 'Content-Type: application/json' \
23+
-d '{
24+
"name": "conversation_store",
25+
"fields": [
26+
{
27+
"name": "conversation_id",
28+
"type": "string"
29+
},
30+
{
31+
"name": "model_id",
32+
"type": "string"
33+
},
34+
{
35+
"name": "timestamp",
36+
"type": "int32"
37+
},
38+
{
39+
"name": "role",
40+
"type": "string",
41+
"index": false
42+
},
43+
{
44+
"name": "message",
45+
"type": "string",
46+
"index": false
47+
}
48+
]
49+
}'
50+
51+
- name: Create or update conversation model
52+
env:
53+
TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_API_KEY }}
54+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
55+
run: |
56+
curl 'https://search.docs.servicestack.net/conversations/models' \
57+
-X POST \
58+
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
59+
-H 'Content-Type: application/json' \
60+
-d '{
61+
"id": "conv-model-1",
62+
"model_name": "google/gemini-flash-latest",
63+
"history_collection": "conversation_store",
64+
"api_key": "'"${GOOGLE_API_KEY}"'",
65+
"system_prompt": "You are an intelligent assistant for question-answering about ServiceStack Software. Try to answer questions using the provided context. If a response has no references in the provided context, politely say you do not have knowledge about that topic.",
66+
"max_bytes": 16384
67+
}'
68+

0 commit comments

Comments
 (0)