update release workflow & CHANGELOG.md

This commit is contained in:
duanfuxiang 2025-01-05 21:15:06 +08:00
parent 5465d5fca3
commit aa4bcf326d
6 changed files with 2493 additions and 557 deletions

View File

@ -2,7 +2,7 @@ name: CI
on:
pull_request:
branches: [main]
branches: [master]
jobs:
check:

View File

@ -5,30 +5,58 @@ on:
tags:
- '*'
env:
PLUGIN_NAME: obsidian-infio-copilot
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: 20.x
- name: Build plugin
- name: Build
id: build
run: |
npm install
npm run build
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test
id: test
run: |
tag="${GITHUB_REF#refs/tags/}"
npm run test
gh release create "$tag" \
--title="$tag" \
--draft \
main.js manifest.json styles.css
- name: Bundle
id: bundle
run: |
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip ${{ env.PLUGIN_NAME }}
ls
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)"
- name: Get release notes
id: release_notes
run: |
CHANGELOG=$(sed -n -e "/## ${{ steps.bundle.outputs.tag_name }}/,/## /p" CHANGELOG.md | sed '/## /d')
if [ -z "$CHANGELOG" ]; then
echo "Error: No release notes found for this version in CHANGELOG.md"
exit 1
fi
echo "::set-output name=body::${CHANGELOG}"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ github.token }}
files: |
${{ env.PLUGIN_NAME }}-${{ steps.bundle.outputs.tag_name }}.zip
main.js
manifest.json
styles.css
body: ${{ steps.release_notes.outputs.body }}

0
CHANGELOG.md Normal file
View File

2883
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -26,12 +26,12 @@
"@types/react-syntax-highlighter": "^15.5.13",
"@types/semver": "^7.5.8",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.57.0",
"builtin-modules": "3.3.0",
"drizzle-kit": "^0.26.2",
"esbuild": "0.17.3",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-neverthrow": "^1.1.4",

View File

@ -1,17 +1,21 @@
import { DEFAULT_MODELS } from '../constants'
import { DEFAULT_AUTOCOMPLETE_SETTINGS } from '../settings/versions/v1/v1'
import { SETTINGS_SCHEMA_VERSION, parseInfioSettings } from './settings'
describe('parseSmartCopilotSettings', () => {
it('should return default values for empty input', () => {
const result = parseInfioSettings({})
expect(result).toEqual({
version: SETTINGS_SCHEMA_VERSION,
version: 0.1,
activeModels: DEFAULT_MODELS,
infioApiKey: '',
openAIApiKey: '',
anthropicApiKey: '',
geminiApiKey: '',
groqApiKey: '',
chatModelId: 'anthropic/claude-3.5-sonnet-latest',
deepseekApiKey: '',
chatModelId: 'deepseek-chat',
ollamaChatModel: {
baseUrl: '',
model: '',
@ -21,8 +25,7 @@ describe('parseSmartCopilotSettings', () => {
apiKey: '',
model: '',
},
applyModelId: 'openai/gpt-4o-mini',
applyModelId: 'deepseek-chat',
ollamaApplyModel: {
baseUrl: '',
model: '',
@ -32,13 +35,11 @@ describe('parseSmartCopilotSettings', () => {
apiKey: '',
model: '',
},
embeddingModelId: 'openai/text-embedding-3-small',
embeddingModelId: 'text-embedding-004',
ollamaEmbeddingModel: {
baseUrl: '',
model: '',
},
systemPrompt: '',
ragOptions: {
chunkSize: 1000,
@ -48,6 +49,34 @@ describe('parseSmartCopilotSettings', () => {
excludePatterns: [],
includePatterns: [],
},
autocompleteEnabled: true,
advancedMode: false,
apiProvider: 'openai',
azureOAIApiSettings: '',
openAIApiSettings: '',
ollamaApiSettings: '',
triggers: DEFAULT_AUTOCOMPLETE_SETTINGS.triggers,
delay: 500,
modelOptions: {
temperature: 1,
top_p: 0.1,
frequency_penalty: 0.25,
presence_penalty: 0,
max_tokens: 800,
},
systemMessage: DEFAULT_AUTOCOMPLETE_SETTINGS.systemMessage,
fewShotExamples: DEFAULT_AUTOCOMPLETE_SETTINGS.fewShotExamples,
userMessageTemplate: '{{prefix}}<mask/>{{suffix}}',
chainOfThoughRemovalRegex: '(.|\\n)*ANSWER:',
dontIncludeDataviews: true,
maxPrefixCharLimit: 4000,
maxSuffixCharLimit: 4000,
removeDuplicateMathBlockIndicator: true,
removeDuplicateCodeBlockIndicator: true,
ignoredFilePatterns: '**/secret/**\n',
ignoredTags: '',
cacheSuggestions: true,
debugMode: false,
})
})
})
@ -73,16 +102,17 @@ describe('settings migration', () => {
const result = parseInfioSettings(oldSettings)
expect(result).toEqual({
version: 1,
openAIApiKey: 'openai-api-key',
anthropicApiKey: 'anthropic-api-key',
version: 0.1,
activeModels: DEFAULT_MODELS,
infioApiKey: '',
openAIApiKey: '',
anthropicApiKey: '',
geminiApiKey: '',
groqApiKey: 'groq-api-key',
chatModelId: 'anthropic/claude-3.5-sonnet-latest',
groqApiKey: '',
deepseekApiKey: '',
chatModelId: 'deepseek-chat',
ollamaChatModel: {
baseUrl: 'http://localhost:11434',
baseUrl: '',
model: '',
},
openAICompatibleChatModel: {
@ -90,10 +120,9 @@ describe('settings migration', () => {
apiKey: '',
model: '',
},
applyModelId: 'openai/gpt-4o-mini',
applyModelId: 'deepseek-chat',
ollamaApplyModel: {
baseUrl: 'http://localhost:11434',
baseUrl: '',
model: '',
},
openAICompatibleApplyModel: {
@ -101,14 +130,12 @@ describe('settings migration', () => {
apiKey: '',
model: '',
},
embeddingModelId: 'openai/text-embedding-3-small',
embeddingModelId: 'text-embedding-004',
ollamaEmbeddingModel: {
baseUrl: 'http://localhost:11434',
baseUrl: '',
model: '',
},
systemPrompt: 'system prompt',
systemPrompt: '',
ragOptions: {
chunkSize: 1000,
thresholdTokens: 8192,
@ -117,6 +144,34 @@ describe('settings migration', () => {
excludePatterns: [],
includePatterns: [],
},
autocompleteEnabled: true,
advancedMode: false,
apiProvider: 'openai',
azureOAIApiSettings: '',
openAIApiSettings: '',
ollamaApiSettings: '',
triggers: DEFAULT_AUTOCOMPLETE_SETTINGS.triggers,
delay: 500,
modelOptions: {
temperature: 1,
top_p: 0.1,
frequency_penalty: 0.25,
presence_penalty: 0,
max_tokens: 800,
},
systemMessage: DEFAULT_AUTOCOMPLETE_SETTINGS.systemMessage,
fewShotExamples: DEFAULT_AUTOCOMPLETE_SETTINGS.fewShotExamples,
userMessageTemplate: '{{prefix}}<mask/>{{suffix}}',
chainOfThoughRemovalRegex: '(.|\\n)*ANSWER:',
dontIncludeDataviews: true,
maxPrefixCharLimit: 4000,
maxSuffixCharLimit: 4000,
removeDuplicateMathBlockIndicator: true,
removeDuplicateCodeBlockIndicator: true,
ignoredFilePatterns: '**/secret/**\n',
ignoredTags: '',
cacheSuggestions: true,
debugMode: false,
})
})
})