File size: 2,314 Bytes
04f192c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!--
SPDX-FileCopyrightText: Copyright contributors to the CopilotJ project.

SPDX-License-Identifier: Apache-2.0
-->

<script setup lang="ts">
import { ref } from "vue";

const props = withDefaults(
  defineProps<{
    proxy: string | null;
    tavilyApiKey: string | null;
    kbAutosave: boolean;
    autoScroll: boolean;
    /** Settings: show the per-tab Save button. Hidden in the wizard (uses Next). */
    showSubmitButton?: boolean;
  }>(),
  { showSubmitButton: false },
);

const emit = defineEmits<{
  (
    e: "update",
    value: { proxy: string | null; tavilyApiKey: string | null; kbAutosave: boolean; autoScroll: boolean },
  ): void;
}>();

const proxy = ref(props.proxy || "");
const tavilyApiKey = ref(props.tavilyApiKey || "");
const kbAutosave = ref(props.kbAutosave);
const autoScroll = ref(props.autoScroll);

function getValue() {
  return {
    proxy: proxy.value || null,
    tavilyApiKey: tavilyApiKey.value || null,
    kbAutosave: kbAutosave.value,
    autoScroll: autoScroll.value,
  };
}

function submit() {
  emit("update", getValue());
}

defineExpose({ getValue });
</script>

<template>
  <div class="flex flex-col gap-6">
    <p class="text-sm text-slate-500 dark:text-slate-400">Optional settings. You can configure these later.</p>

    <FormItem for="proxy" label="HTTP Proxy">
      <InputText
        type="text"
        v-model="proxy"
        inputId="proxy"
        placeholder="http://127.0.0.1:8080 (optional)"
        class="w-full"
      />
    </FormItem>

    <FormItem for="tavilyApiKey" label="Tavily API Key">
      <InputText
        type="password"
        v-model="tavilyApiKey"
        inputId="tavilyApiKey"
        placeholder="tvly-xxxxxxxx (optional, for web search)"
        class="w-full"
      />
    </FormItem>

    <!-- "Auto-save to Knowledge Bank" toggle — hidden; value always sent as null. TODO: temporarily disabled -->
    <!-- <FormItem for="kbAutosave" label="Auto-save to Knowledge Bank" layout="row">
      <ToggleSwitch v-model="kbAutosave" inputId="kbAutosave" />
    </FormItem> -->

    <FormItem for="autoScroll" label="Auto-scroll to Bottom" layout="row">
      <ToggleSwitch v-model="autoScroll" inputId="autoScroll" />
    </FormItem>

    <Button v-if="showSubmitButton" label="Save" @click="submit" />
  </div>
</template>