Skip to content

Commit c54f243

Browse files
feat: 支持 OpenRouter/Qwen 多模型推理与完整用法说明
0 parents  commit c54f243

File tree

139 files changed

+48730
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+48730
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.clineignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package-lock.json
2+
node_modules/
3+
dist/
4+
.git/
5+
*.log
6+
.env.*
7+
!.env.example
8+
!.github/

.clinerules

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Cline Custom Instructions
2+
3+
- ALWAYS refer to the `README.md` for the latest information on the project.
4+
- ALWAYS refer to `ARCHITECTURE.md` for the latest information on the architecture of the project.
5+
- ALWAYS Follow programming principles such as DRY, KISS, YAGNI, and SOLID
6+
- ALWAYS use the latest version of the programming language and libraries.
7+
- ALWAYS prefer the simplest solution.
8+
- When importing a relative path, avoid using file extensions like ".js" and ".ts".
9+
- ALWAYS add and update TSDoc for all classes, methods and functions. Focus on functionality and reasoning.
10+
- NEVER document individual parameters or return values if their use can easily be derived from their name.
11+
12+
## Architecture Documentation Guidelines
13+
14+
Keep `ARCHITECTURE.md` high-level:
15+
16+
- Focus on system concepts and component relationships
17+
- Include design principles and code conventions
18+
- Use simple MermaidJS diagrams for visualization
19+
- Put implementation details in source code
20+
- Update when architecture changes
21+
22+
## Git
23+
24+
- The repository owner and name is `arabold/docs-mcp-server` on GitHub.
25+
- AWLAYS create new branches locally first before pushing them to the GitHub repository.
26+
- ALWAYS format Git commit messages as markdown.
27+
- ALWAYS adhere to the Conventional Commits specification for all Git commit messages
28+
- ALWAYS prefix branch names with the type of work being done, such as `feature/`, `bugfix/`, `chore/`, etc.
29+
- ALWAYS include the issue number in the branch name, such as `feature/1234-issue-name`.

.dockerignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Docker specific
2+
Dockerfile
3+
.dockerignore
4+
5+
# Version control
6+
.git
7+
.github
8+
.husky
9+
10+
# Already in gitignore but explicitly listed for Docker context
11+
node_modules
12+
dist
13+
*.log
14+
.env*
15+
16+
# Other
17+
.store
18+
README.md
19+
ARCHITECTURE.md
20+
CHANGELOG.md

.env.example

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Embedding Model Configuration
2+
# Optional: Format is "provider:model_name" or just "model_name" for OpenAI (default)
3+
# Examples:
4+
# - openai:text-embedding-3-small (default if no provider specified)
5+
# - vertex:text-embedding-004 (Google Cloud Vertex AI)
6+
# - gemini:gemini-embedding-exp-03-07 (Google Generative AI)
7+
# - aws:amazon.titan-embed-text-v1
8+
# - microsoft:text-embedding-ada-002
9+
DOCS_MCP_EMBEDDING_MODEL=
10+
11+
# OpenAI Provider Configuration (Default)
12+
# Required for OpenAI provider or as fallback
13+
OPENAI_API_KEY=your-key-here
14+
# Optional: Your OpenAI Organization ID
15+
OPENAI_ORG_ID=
16+
# Optional: Custom base URL for OpenAI-compatible APIs (e.g., Ollama, Azure OpenAI)
17+
OPENAI_API_BASE=
18+
19+
# Google Cloud Vertex AI Configuration
20+
# Required for vertex provider: Path to service account JSON key file
21+
GOOGLE_APPLICATION_CREDENTIALS=/path/to/gcp-key.json
22+
23+
# Google Generative AI (Gemini) Configuration
24+
# Required for gemini provider: Google API key
25+
GOOGLE_API_KEY=your-google-api-key
26+
27+
# AWS Bedrock Configuration
28+
# Required for aws provider
29+
AWS_ACCESS_KEY_ID=your-aws-key
30+
AWS_SECRET_ACCESS_KEY=your-aws-secret
31+
AWS_REGION=us-east-1
32+
# Optional: Use BEDROCK_AWS_REGION instead of AWS_REGION if needed
33+
# BEDROCK_AWS_REGION=us-east-1
34+
35+
# Azure OpenAI Configuration
36+
# Required for microsoft provider
37+
AZURE_OPENAI_API_KEY=your-azure-key
38+
AZURE_OPENAI_API_INSTANCE_NAME=your-instance
39+
AZURE_OPENAI_API_DEPLOYMENT_NAME=your-deployment
40+
AZURE_OPENAI_API_VERSION=2024-02-01
41+
42+
# Optional: Specify a custom directory to store the SQLite database file (documents.db).
43+
# If set, this path takes precedence over the default locations.
44+
# Default behavior (if unset):
45+
# 1. Uses './.store/' in the project root if it exists (legacy).
46+
# 2. Falls back to OS-specific data directory (e.g., ~/Library/Application Support/docs-mcp-server on macOS).
47+
# DOCS_MCP_STORE_PATH=/path/to/your/desired/storage/directory

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '>=20.0.0' # Match engines requirement in package.json
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Run linter
27+
run: npm run lint
28+
29+
test:
30+
name: Test
31+
runs-on: ubuntu-latest
32+
needs: lint # Run after linting passes
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Node.js
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: '>=20.0.0'
41+
cache: 'npm'
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Install Playwright browsers
47+
# FIXME: Why is this needed? Where does the version conflict come from?
48+
run: ln -s /home/runner/.cache/ms-playwright/chromium-1161 /home/runner/.cache/ms-playwright/chromium-1169
49+
50+
- name: Run tests
51+
# run: npm run test
52+
run: npx vitest run
53+
54+
build:
55+
name: Build
56+
runs-on: ubuntu-latest
57+
needs: test # Run after tests pass
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@v4
61+
62+
- name: Set up Node.js
63+
uses: actions/setup-node@v4
64+
with:
65+
node-version: '>=20.0.0'
66+
cache: 'npm'
67+
68+
- name: Install dependencies
69+
run: npm ci
70+
71+
- name: Run build
72+
run: npm run build

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch: # Allows manual triggering
5+
6+
jobs:
7+
release:
8+
name: Release to npm and GitHub
9+
runs-on: ubuntu-latest
10+
# Permissions needed for semantic-release to commit/tag/release
11+
permissions:
12+
contents: write
13+
issues: write
14+
pull-requests: write
15+
# id-token: write # Needed for OIDC trusted publishing (if not using NPM_TOKEN)
16+
outputs:
17+
# Output whether a new release was published
18+
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
19+
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
20+
steps:
21+
- name: Checkout code
22+
# Need fetch-depth: 0 for semantic-release to analyze all relevant commits
23+
# and commit package.json/CHANGELOG.md changes
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '>=20.0.0' # Match engines requirement in package.json
32+
registry-url: 'https://registry.npmjs.org' # Specify npm registry
33+
cache: 'npm'
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Run build
39+
run: npm run build
40+
41+
- name: Run semantic-release
42+
id: semantic # Give step an ID to reference its outputs
43+
uses: cycjimmy/semantic-release-action@v4
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
48+
docker_publish:
49+
name: Build and Push Docker Image to GHCR
50+
# Run only after the release job completes successfully
51+
needs: release
52+
# Run only if semantic-release actually published a new version
53+
if: needs.release.outputs.new_release_published == 'true'
54+
runs-on: ubuntu-latest
55+
permissions:
56+
contents: read # Needed to check out the code
57+
packages: write # Needed to push Docker image to GHCR
58+
attestations: write # Needed for build attestations
59+
id-token: write # Needed for OIDC (good practice)
60+
61+
steps:
62+
- name: Checkout code
63+
# Checkout the specific commit tagged by semantic-release
64+
uses: actions/checkout@v4
65+
with:
66+
# Use the tag name determined by the release job
67+
ref: v${{ needs.release.outputs.new_release_version }}
68+
69+
- name: Set up Docker Buildx
70+
uses: docker/setup-buildx-action@v3
71+
72+
- name: Log in to GitHub Container Registry
73+
uses: docker/login-action@v3
74+
with:
75+
registry: ghcr.io
76+
username: ${{ github.actor }}
77+
password: ${{ secrets.GITHUB_TOKEN }}
78+
79+
- name: Extract Docker metadata
80+
id: meta
81+
uses: docker/metadata-action@v5
82+
with:
83+
images: ghcr.io/${{ github.repository }}
84+
# Use the version from the semantic-release output
85+
tags: |
86+
type=raw,value=${{ needs.release.outputs.new_release_version }} # e.g., v1.4.1
87+
type=semver,pattern={{version}},value=${{ needs.release.outputs.new_release_version }} # e.g., 1.4.1
88+
type=semver,pattern=v{{major}}.{{minor}},value=${{ needs.release.outputs.new_release_version }} # e.g., v1.4
89+
type=semver,pattern=v{{major}},value=${{ needs.release.outputs.new_release_version }} # e.g., v1
90+
type=raw,value=latest,enable=true # Always tag latest on main branch release
91+
92+
- name: Build and push Docker image
93+
id: push
94+
uses: docker/build-push-action@v6
95+
with:
96+
context: .
97+
push: true
98+
tags: ${{ steps.meta.outputs.tags }}
99+
labels: ${{ steps.meta.outputs.labels }}
100+
cache-from: type=gha
101+
cache-to: type=gha,mode=max
102+
103+
- name: Generate artifact attestation
104+
uses: actions/attest-build-provenance@v1
105+
with:
106+
subject-name: ghcr.io/${{ github.repository }}
107+
subject-digest: ${{ steps.push.outputs.digest }}
108+
push-to-registry: true

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
dist/
3+
.store/
4+
*.log
5+
.env*
6+
!*.env.example
7+
*.code-workspace

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx commitlint --edit $1

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

0 commit comments

Comments
 (0)