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: on:
pull_request: pull_request:
branches: [main] branches: [master]
jobs: jobs:
check: check:

View File

@ -5,30 +5,58 @@ on:
tags: tags:
- '*' - '*'
env:
PLUGIN_NAME: obsidian-infio-copilot
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Use Node.js - name: Use Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v1
with: with:
node-version: '18.x' node-version: 20.x
- name: Build plugin - name: Build
id: build
run: | run: |
npm install npm install
npm run build npm run build
- name: Create release - name: Test
env: id: test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
tag="${GITHUB_REF#refs/tags/}" npm run test
gh release create "$tag" \ - name: Bundle
--title="$tag" \ id: bundle
--draft \ run: |
main.js manifest.json styles.css 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/react-syntax-highlighter": "^15.5.13",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "5.29.0", "@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.57.0",
"builtin-modules": "3.3.0", "builtin-modules": "3.3.0",
"drizzle-kit": "^0.26.2", "drizzle-kit": "^0.26.2",
"esbuild": "0.17.3", "esbuild": "0.17.3",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.30.0", "eslint-plugin-import": "^2.30.0",
"eslint-plugin-neverthrow": "^1.1.4", "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' import { SETTINGS_SCHEMA_VERSION, parseInfioSettings } from './settings'
describe('parseSmartCopilotSettings', () => { describe('parseSmartCopilotSettings', () => {
it('should return default values for empty input', () => { it('should return default values for empty input', () => {
const result = parseInfioSettings({}) const result = parseInfioSettings({})
expect(result).toEqual({ expect(result).toEqual({
version: SETTINGS_SCHEMA_VERSION, version: 0.1,
activeModels: DEFAULT_MODELS,
infioApiKey: '',
openAIApiKey: '', openAIApiKey: '',
anthropicApiKey: '', anthropicApiKey: '',
geminiApiKey: '', geminiApiKey: '',
groqApiKey: '', groqApiKey: '',
deepseekApiKey: '',
chatModelId: 'anthropic/claude-3.5-sonnet-latest', chatModelId: 'deepseek-chat',
ollamaChatModel: { ollamaChatModel: {
baseUrl: '', baseUrl: '',
model: '', model: '',
@ -21,8 +25,7 @@ describe('parseSmartCopilotSettings', () => {
apiKey: '', apiKey: '',
model: '', model: '',
}, },
applyModelId: 'deepseek-chat',
applyModelId: 'openai/gpt-4o-mini',
ollamaApplyModel: { ollamaApplyModel: {
baseUrl: '', baseUrl: '',
model: '', model: '',
@ -32,13 +35,11 @@ describe('parseSmartCopilotSettings', () => {
apiKey: '', apiKey: '',
model: '', model: '',
}, },
embeddingModelId: 'text-embedding-004',
embeddingModelId: 'openai/text-embedding-3-small',
ollamaEmbeddingModel: { ollamaEmbeddingModel: {
baseUrl: '', baseUrl: '',
model: '', model: '',
}, },
systemPrompt: '', systemPrompt: '',
ragOptions: { ragOptions: {
chunkSize: 1000, chunkSize: 1000,
@ -48,6 +49,34 @@ describe('parseSmartCopilotSettings', () => {
excludePatterns: [], excludePatterns: [],
includePatterns: [], 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) const result = parseInfioSettings(oldSettings)
expect(result).toEqual({ expect(result).toEqual({
version: 1, version: 0.1,
activeModels: DEFAULT_MODELS,
openAIApiKey: 'openai-api-key', infioApiKey: '',
anthropicApiKey: 'anthropic-api-key', openAIApiKey: '',
anthropicApiKey: '',
geminiApiKey: '', geminiApiKey: '',
groqApiKey: 'groq-api-key', groqApiKey: '',
deepseekApiKey: '',
chatModelId: 'anthropic/claude-3.5-sonnet-latest', chatModelId: 'deepseek-chat',
ollamaChatModel: { ollamaChatModel: {
baseUrl: 'http://localhost:11434', baseUrl: '',
model: '', model: '',
}, },
openAICompatibleChatModel: { openAICompatibleChatModel: {
@ -90,10 +120,9 @@ describe('settings migration', () => {
apiKey: '', apiKey: '',
model: '', model: '',
}, },
applyModelId: 'deepseek-chat',
applyModelId: 'openai/gpt-4o-mini',
ollamaApplyModel: { ollamaApplyModel: {
baseUrl: 'http://localhost:11434', baseUrl: '',
model: '', model: '',
}, },
openAICompatibleApplyModel: { openAICompatibleApplyModel: {
@ -101,14 +130,12 @@ describe('settings migration', () => {
apiKey: '', apiKey: '',
model: '', model: '',
}, },
embeddingModelId: 'text-embedding-004',
embeddingModelId: 'openai/text-embedding-3-small',
ollamaEmbeddingModel: { ollamaEmbeddingModel: {
baseUrl: 'http://localhost:11434', baseUrl: '',
model: '', model: '',
}, },
systemPrompt: '',
systemPrompt: 'system prompt',
ragOptions: { ragOptions: {
chunkSize: 1000, chunkSize: 1000,
thresholdTokens: 8192, thresholdTokens: 8192,
@ -117,6 +144,34 @@ describe('settings migration', () => {
excludePatterns: [], excludePatterns: [],
includePatterns: [], 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,
}) })
}) })
}) })