add local llm

This commit is contained in:
eduard committed 2025-12-12 16:34:29 +01:00
1 parent 3568453103
commit 88272b19a8
7 files changed
+1803 -5

No files matched your search

+1669
View File
File diff suppressed because it is too large. Load diff
+32
View File
@@ -24,6 +24,9 @@ const expanded = ref(false)
<span class="badge badge-warning">
Anthropic: {{ result.llmAnalysisAnthropic?.prediction || 'N/A' }}
</span>
<span class="badge badge-success">
Ollama: {{ result.llmAnalysisOllama?.prediction || 'N/A' }}
</span>
</div>
<button class="expand-btn">
{{ expanded ? '▼' : '▶' }}
@@ -169,6 +172,35 @@ const expanded = ref(false)
<div class="text-muted">Analysis not available</div>
</div>
</div>
<!-- Ollama -->
<div class="analysis-box mt-2">
<div class="analysis-header">
<span class="badge badge-success">Ollama (Gemma 2 27B)</span>
</div>
<div class="analysis-content" v-if="result.llmAnalysisOllama">
<div class="flex gap-2 mb-2">
<div class="metric-card" style="flex: 1;">
<div class="metric-label">Prediction</div>
<div class="metric-value" style="font-size: 1.1rem;">
{{ result.llmAnalysisOllama.prediction }}
</div>
</div>
<div class="metric-card" style="flex: 1;">
<div class="metric-label">Probability</div>
<div class="metric-value" style="font-size: 1.1rem;">
{{ result.llmAnalysisOllama.probability }}%
</div>
</div>
</div>
<div class="reasoning">
<strong>Reasoning:</strong> {{ result.llmAnalysisOllama.reasoning }}
</div>
</div>
<div class="analysis-content" v-else>
<div class="text-muted">Analysis not available</div>
</div>
</div>
</div>
<!-- News & Sentiment -->
+1
View File
@@ -50,6 +50,7 @@ export interface AnalysisResult {
socialPosts: string[]
llmAnalysisOpenai: LLMAnalysis
llmAnalysisAnthropic: LLMAnalysis
llmAnalysisOllama?: LLMAnalysis
analyzedAt: string
date: string
targetDate: string
+8
View File
@@ -138,6 +138,7 @@ async function handleStop() {
<th>Change</th>
<th>OpenAI</th>
<th>Anthropic</th>
<th>Ollama</th>
</tr>
</thead>
<tbody>
@@ -176,6 +177,13 @@ async function handleStop() {
</span>
<span v-else class="text-muted">N/A</span>
</td>
<td>
<span v-if="result.llmAnalysisOllama" class="badge badge-success">
{{ result.llmAnalysisOllama.prediction }}
({{ result.llmAnalysisOllama.probability }}%)
</span>
<span v-else class="text-muted">N/A</span>
</td>
</tr>
</tbody>
</table>
+44 -5
View File
@@ -61,7 +61,7 @@ const tableData = computed(() => {
isin,
symbol,
latestResult: null,
accuracy: { openaiPct: 0, anthropicPct: 0, total: 0 }
accuracy: { openaiPct: 0, anthropicPct: 0, ollamaPct: 0, total: 0 }
})
return
}
@@ -106,7 +106,7 @@ const filteredData = computed(() => {
} else if (sortBy.value === 'symbol') {
return a.symbol.localeCompare(b.symbol)
} else if (sortBy.value === 'accuracy') {
return (b.accuracy.openaiPct + b.accuracy.anthropicPct) - (a.accuracy.openaiPct + a.accuracy.anthropicPct)
return (b.accuracy.openaiPct + b.accuracy.anthropicPct + b.accuracy.ollamaPct) - (a.accuracy.openaiPct + a.accuracy.anthropicPct + a.accuracy.ollamaPct)
}
return 0
})
@@ -122,6 +122,7 @@ const selectedDetails = computed(() => {
function calculateAccuracy(results: AnalysisResult[]) {
let openaiCorrect = 0
let anthropicCorrect = 0
let ollamaCorrect = 0
let total = 0
for (const result of results) {
@@ -133,23 +134,37 @@ function calculateAccuracy(results: AnalysisResult[]) {
// OpenAI
const openaiPred = result.llmAnalysisOpenai?.prediction?.toUpperCase() || ''
if ((openaiPred.includes('BULLISH') && endPrice > startPrice) ||
(openaiPred.includes('BEARISH') && endPrice < startPrice)) {
(openaiPred.includes('BEARISH') && endPrice < startPrice) ||
(openaiPred.includes('RISE') && endPrice > startPrice) ||
(openaiPred.includes('FALL') && endPrice < startPrice)) {
openaiCorrect++
}
// Anthropic
const anthropicPred = result.llmAnalysisAnthropic?.prediction?.toUpperCase() || ''
if ((anthropicPred.includes('BULLISH') && endPrice > startPrice) ||
(anthropicPred.includes('BEARISH') && endPrice < startPrice)) {
(anthropicPred.includes('BEARISH') && endPrice < startPrice) ||
(anthropicPred.includes('RISE') && endPrice > startPrice) ||
(anthropicPred.includes('FALL') && endPrice < startPrice)) {
anthropicCorrect++
}
// Ollama
const ollamaPred = result.llmAnalysisOllama?.prediction?.toUpperCase() || ''
if ((ollamaPred.includes('BULLISH') && endPrice > startPrice) ||
(ollamaPred.includes('BEARISH') && endPrice < startPrice) ||
(ollamaPred.includes('RISE') && endPrice > startPrice) ||
(ollamaPred.includes('FALL') && endPrice < startPrice)) {
ollamaCorrect++
}
}
}
const openaiPct = total > 0 ? Math.round((openaiCorrect / total) * 100) : 0
const anthropicPct = total > 0 ? Math.round((anthropicCorrect / total) * 100) : 0
const ollamaPct = total > 0 ? Math.round((ollamaCorrect / total) * 100) : 0
return { openaiPct, anthropicPct, total }
return { openaiPct, anthropicPct, ollamaPct, total }
}
async function handleDeleteByDateRange() {
@@ -304,6 +319,7 @@ function getJobStatus(isin: string) {
<th>Target Date</th>
<th>Latest Prediction (OpenAI)</th>
<th>Latest Prediction (Anthropic)</th>
<th>Latest Prediction (Ollama)</th>
<th>Accuracy</th>
<th>History Size</th>
<th>Action</th>
@@ -333,10 +349,17 @@ function getJobStatus(isin: string) {
</span>
<span v-else class="text-muted">N/A</span>
</td>
<td>
<span v-if="item.latestResult?.llmAnalysisOllama" class="badge badge-success">
{{ item.latestResult.llmAnalysisOllama.prediction }}
</span>
<span v-else class="text-muted">N/A</span>
</td>
<td>
<div class="flex flex-col gap-1" style="font-size: 0.75rem;">
<span class="text-info">OpenAI: {{ item.accuracy.openaiPct }}%</span>
<span class="text-warning">Anthropic: {{ item.accuracy.anthropicPct }}%</span>
<span class="text-success">Ollama: {{ item.accuracy.ollamaPct }}%</span>
<span class="text-muted" style="font-size: 0.7rem;">({{ item.accuracy.total }} verified)</span>
</div>
</td>
@@ -376,6 +399,9 @@ function getJobStatus(isin: string) {
<span class="badge badge-warning">
Anthropic Accuracy: {{ calculateAccuracy(selectedDetails).anthropicPct }}%
</span>
<span class="badge badge-success">
Ollama Accuracy: {{ calculateAccuracy(selectedDetails).ollamaPct }}%
</span>
</div>
</div>
@@ -389,6 +415,7 @@ function getJobStatus(isin: string) {
<th>Real Price</th>
<th>OpenAI</th>
<th>Anthropic</th>
<th>Ollama</th>
</tr>
</thead>
<tbody>
@@ -437,6 +464,18 @@ function getJobStatus(isin: string) {
</div>
<div v-else class="text-muted">N/A</div>
</td>
<td>
<div v-if="result.llmAnalysisOllama">
<span class="badge badge-success">
{{ result.llmAnalysisOllama.prediction }}
</span>
<span class="text-muted"> ⏳</span>
</div>
<div v-if="result.llmAnalysisOllama" class="text-muted" style="font-size: 0.75rem; margin-top: 0.25rem;">
{{ result.llmAnalysisOllama.reasoning.substring(0, 100) }}...
</div>
<div v-else class="text-muted">N/A</div>
</td>
</tr>
</tbody>
</table>